summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-09-21 15:44:56 +0200
committerChristian Brauner <brauner@kernel.org>2026-10-05 13:11:50 +0200
commit296a98c1fa50778c3b31eebed1a3f903f9684349 (patch)
tree338ddae5437e83c4b1b93edd6eeb0c8935e2e4e6 /tools/lib/python
parent97f08aa8224ed9b8643b905acf027cb7ed93bded (diff)
downloadlinux-next-296a98c1fa50778c3b31eebed1a3f903f9684349.tar.gz
linux-next-296a98c1fa50778c3b31eebed1a3f903f9684349.zip
fork: release the files of a failed fork after sched_cancel_fork()
Reorder copy_process() cleanup so sched_fork() taking scx_fork_rwsem scx_pre_fork() is safe and isn't held around exiting files. Right now, a fork that fails while another thread closed the bpf link fd will deadlock against its own read side. It also blocks every fork on the system: copy_process() holds scx_fork_rwsem for read exit_files() close_files() filp_close_sync() bpf_scx_unreg() kthread_flush_work() waits for the disable work scx_root_disable() percpu_down_write(&scx_fork_rwsem) Simply release the child's files after sched_cancel_fork() dropped the lock. The task starts out as a copy of its parent so p->files points to the parent's table until copy_files() replaces it. exit_files() must not run for a fork that failed before that. Clear p->files up front so exit_files() is a no-op for those and make copy_files() set it explicitly for CLONE_FILES. Reported-by: Chris Mason <mason@kernel.org> Link: https://patch.msgid.link/20260921-work-coredump-fixes-v3-7-8e4adb1619e6@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions