walnux/sched/task
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
..
CMakeLists.txt binfmt:use crt0 inside of starthook 2025-04-09 23:07:29 +08:00
exit.c sched: add header irq.h to exit.c 2024-11-04 11:07:40 -03:00
Make.defs binfmt:use crt0 inside of starthook 2025-04-09 23:07:29 +08:00
spawn.h sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task.h task: merge nxtask_setup_name() before create_stack 2024-10-07 15:47:13 +08:00
task_activate.c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
task_argvstr.c Rename group_argvstr to nxtask_argvstr 2024-10-10 23:13:37 +08:00
task_cancelpt.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_create.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_delete.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_execve.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_exit.c task_exit.c: Add missing sched_note_stop() 2024-10-23 12:08:18 -03:00
task_exithook.c sched: Replace direct semaphore value access with nxsem_get_value 2025-04-07 16:29:57 +08:00
task_fork.c pthread: remove enter_critical_section in pthread_mutex 2025-01-12 22:30:35 +08:00
task_getgroup.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_getpid.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_getppid.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_gettid.c sched/gettid: Move thread ID to TLS 2025-04-08 22:53:10 +08:00
task_init.c sched/gettid: Move thread ID to TLS 2025-04-08 22:53:10 +08:00
task_join.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_posixspawn.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_prctl.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_recover.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_reparent.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_restart.c sched: unify Private Types banners 2025-05-28 10:17:15 +08:00
task_setup.c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
task_spawn.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
task_spawnparms.c fs/vfs: Separate file descriptors from file descriptions 2025-06-12 18:12:42 +08:00
task_start.c binfmt:use crt0 inside of starthook 2025-04-09 23:07:29 +08:00
task_terminate.c sched/affinity: Fix CPU_LOCKED functionality for some SMP calls 2025-04-26 13:56:27 +08:00