nuttx/drivers/misc
Ville Juven b8e30b54ec fs/vfs: Separate file descriptors from file descriptions
This patch is a rework of the NuttX file descriptor implementation. The
goal is two-fold:

1. Improve POSIX compliance. The old implementation tied file description
to inode only, not the file struct. POSIX however dictates otherwise.
2. Fix a bug with descriptor duplication (dup2() and dup3()). There is
an existing race condition with this POSIX API that currently results
in a kernel side crash.

The crash occurs when a partially open / closed file descriptor is
duplicated. The reason for the crash is that even if the descriptor is
closed, the file might still be in use by the kernel (due to e.g. ongoing
write to file). The open file data is changed by file_dup3() and this
causes a crash in the device / drivers themselves as they lose access to
the inode and private data.

The fix is done by separating struct file into file and file descriptor
structs. The file struct can live on even if the descriptor is closed,
fixing the crash. This also fixes the POSIX issue, as two descriptors
can now point to the same file.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
..
addrenv.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
CMakeLists.txt drivers/misc/optee: Add SMC backend for arm archs 2025-05-09 10:29:26 +08:00
dev_ascii.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
dev_mem.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
dev_null.c drivers/iovec: revert vector io implement from loop/null/zero driver 2025-01-22 11:29:39 +08:00
dev_zero.c drivers/iovec: revert vector io implement from loop/null/zero driver 2025-01-22 11:29:39 +08:00
goldfish_pipe.c fs/drivers: Avoid causing a busy loop in the program due to context switching induced by sem_post. 2025-03-17 10:44:26 +01:00
Kconfig drivers/misc/optee: Add SMC backend for arm archs 2025-05-09 10:29:26 +08:00
lwl_console.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
Make.defs drivers/misc/optee: Add SMC backend for arm archs 2025-05-09 10:29:26 +08:00
mkrd.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
optee.c fs/vfs: Separate file descriptors from file descriptions 2025-06-12 18:12:42 +08:00
optee.h drivers/misc/optee: Fix non-registered memory ref passing 2025-05-13 10:14:01 +08:00
optee_msg.h Remove @ and % tag from all comments 2023-12-11 17:00:10 -03:00
optee_smc.c drivers/misc/optee: Rename optee_shm_entry to optee_shm 2025-05-13 10:14:01 +08:00
optee_smc.h drivers/misc/optee: Add SMC backend for arm archs 2025-05-09 10:29:26 +08:00
optee_socket.c drivers/misc/optee.c: Add shm registration support 2025-05-09 10:29:26 +08:00
ramdisk.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
rpmsgblk.c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
rpmsgblk.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
rpmsgblk_server.c drivers/rpmsgblk_server: fix the syslog format warning 2025-03-03 07:37:13 +08:00
rpmsgdev.c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
rpmsgdev.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
rpmsgdev_server.c drivers/misc: fix rpmsg dev poll assert crash 2024-11-12 14:58:53 +08:00
rwbuffer.c bch: add BIOC_DISCARD ioctl that discards cached sector 2025-01-23 02:35:46 +08:00