fork: Make init and umh ordinary tasks
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest7 patches 12 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | kthread: Don't allocate kthread_struct for init and umhfs/ include/ init/ +2 more | +30 | 4 replies | |
| 2/7 | fork: Pass struct kernel_clone_args into copy_threadarch/ arch/ arch/ +22 more | +116 | 1 reply | |
| 3/7 | fork: Explicity test for idle tasks in copy_threadarch/ arch/ include/ +1 more | +12 | 0 replies | |
| 4/7 | fork: Generalize PF_IO_WORKER handlingarch/ arch/ arch/ +25 more | +95 | 0 replies | |
| 5/7 | init: Deal with the init process being a user mode processinit/ | +2 | 0 replies | |
| 6/7 | fork: Explicitly set PF_KTHREADkernel/ | +3 | 0 replies | |
| 7/7 | fork: Stop allowing kthreads to call execvefs/ | +3 | 0 replies |
Reviews trailers per patch
None of the 7 patches has a Reviewed-by or Acked-by.
| Patch | Qian Cai |
|---|---|
| Series | T-b T-b |
| 1/7 | |
| 2/7 | |
| 3/7 | |
| 4/7 | |
| 5/7 | |
| 6/7 | |
| 7/7 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/7] fork: Make init and umh ordinary tasks
In commit 40966e316f86 ("kthread: Ensure struct kthread is present for all kthreads") caused init and the user mode helper threads that call kernel_execve to have struct kthread allocated for them.
I believe my first patch in this series is enough to fix the bug and is simple enough and obvious enough to be backportable.
The rest of the changes pass struct kernel_clone_args to clean things up and cause the code to make sense.
There is one rough spot in this change. In the init process before the user space init process is exec'd there is a lot going on. I have found when async_schedule_domain is low on memory or has more than 32K callers executing do_populate_rootfs will now run in a user space thread making flush_delayed_fput meaningless, and __fput_sync is unusable. I solved this as I did in usermode_driver.c with an added explicit task_work_run. I point this out as I have seen some talk about making flushing file handles more explicit.
Eric W. Biederman (7):
kthread: Don't allocate kthread_struct for init and umh
fork: Pass struct kernel_clone_args into copy_thread
fork: Explicity test for idle tasks in copy_thread
fork: Generalize PF_IO_WORKER handling
init: Deal with the init process being a user mode process
fork: Explicitly set PF_KTHREAD
fork: Stop allowing kthreads to call execve
arch/alpha/kernel/process.c | 13 ++++++------ arch/arc/kernel/process.c | 13 ++++++------ arch/arm/kernel/process.c | 12 ++++++----- arch/arm64/kernel/process.c | 12 ++++++----- arch/csky/kernel/process.c | 15 ++++++------- arch/h8300/kernel/process.c | 10 ++++----- arch/hexagon/kernel/process.c | 12 ++++++----- arch/ia64/kernel/process.c | 15 +++++++------ arch/m68k/kernel/process.c | 12 ++++++----- arch/microblaze/kernel/process.c | 12 ++++++----- arch/mips/kernel/process.c | 13 ++++++------ arch/nios2/kernel/process.c | 12 ++++++----- arch/openrisc/kernel/process.c | 12 ++++++----- arch/parisc/kernel/process.c | 18 +++++++++------- arch/powerpc/kernel/process.c | 15 +++++++------ arch/riscv/kernel/process.c | 12 ++++++----- arch/s390/kernel/process.c | 12 ++++++----- arch/sh/kernel/process_32.c | 12 ++++++----- arch/sparc/kernel/process_32.c | 12 ++++++----- arch/sparc/kernel/process_64.c | 12 ++++++----- arch/um/kernel/process.c | 15 +++++++------ arch/x86/include/asm/fpu/sched.h | 2 +- arch/x86/include/asm/switch_to.h | 8 +++---- arch/x86/kernel/fpu/core.c | 4 ++-- arch/x86/kernel/process.c | 18 +++++++++------- arch/xtensa/kernel/process.c | 17 ++++++++------- fs/exec.c | 8 ++++--- include/linux/sched/task.h | 8 +++++-- init/initramfs.c | 2 ++ init/main.c | 2 +- kernel/fork.c | 46 +++++++++++++++++++++++++++++++++------- kernel/umh.c | 6 +++--- 32 files changed, 233 insertions(+), 159 deletions(-)
Eric