Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pidfd.v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux

Pull pidfd fix from Christian Brauner:
"This fixes a problem reported by lockdep when installing a pidfd via
fd_install() with siglock and the tasklisk write lock held in
copy_process() when calling clone()/clone3() with CLONE_PIDFD.

Originally a pidfd was created prior to holding any of these locks but
this required a call to ksys_close(). So quite some time ago in
6fd2fe494b17 ("copy_process(): don't use ksys_close() on cleanups") we
switched to a get_unused_fd_flags() + fd_install() model.

As part of that we moved fd_install() as late as possible. This was
done for two main reasons. First, because we needed to ensure that we
call fd_install() past the point of no return as once that's called
the fd is live in the task's file table. Second, because we tried to
ensure that the fd is visible in /proc/<pid>/fd/<pidfd> right when the
task is visible.

This fix moves the fd_install() to an even later point which means
that a task will be visible in proc while the pidfd isn't yet under
/proc/<pid>/fd/<pidfd>.

While this is a user visible change it's very unlikely that this will
have any impact. Nobody should be relying on that and if they do we
need to come up with something better but again, it's doubtful this is
relevant"

* tag 'pidfd.v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
copy_process(): Move fd_install() out of sighand->siglock critical section

+3 -4
+3 -4
kernel/fork.c
··· 2323 2323 goto bad_fork_cancel_cgroup; 2324 2324 } 2325 2325 2326 - /* past the last point of failure */ 2327 - if (pidfile) 2328 - fd_install(pidfd, pidfile); 2329 - 2330 2326 init_task_pid_links(p); 2331 2327 if (likely(p->pid)) { 2332 2328 ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); ··· 2370 2374 spin_unlock(&current->sighand->siglock); 2371 2375 syscall_tracepoint_update(p); 2372 2376 write_unlock_irq(&tasklist_lock); 2377 + 2378 + if (pidfile) 2379 + fd_install(pidfd, pidfile); 2373 2380 2374 2381 proc_fork_connector(p); 2375 2382 sched_post_fork(p, args);