On Tue, Feb 08, 2022 at 11:39:12AM -0500, Waiman Long wrote:I think the fd_install() call can be moved after the release of sighand->siglock but before the release the tasklist_lock. Will that be good enough?
One way to solve this problem is to move the fd_install() call out ofUmm... That assumes we can delay it that far. IOW, that nothing
the sighand->siglock critical section.
Before commit 6fd2fe494b17 ("copy_process(): don't use ksys_close()
on cleanups"), the pidfd installation was done without holding both
the task_list lock and the sighand->siglock. Obviously, holding these
two locks are not really needed to protect the fd_install() call.
So move the fd_install() call down to after the releases of both locks.
relies upon having pidfd observable in /proc/*/fd as soon as the child
becomes visible there in the first place.
What warranties are expected from CLONE_PIDFD wrt observation of
child's descriptor table?