On 03/19, Christian Brauner wrote: > > On Tue, Mar 18, 2025 at 03:46:54PM +0100, Oleg Nesterov wrote: > > > > Why pidfs_pid_valid() can't simply return false if !pid_has_task(pid,type) ? > > > > pidfd_open() paths check pid_has_task() too and fail if it returns NULL. > > If this task is already reaped when pidfs_pid_valid() is called, we can > > pretend it was reaped before sys_pidfd_open() was called? > > We could for sure but why would we. If we know that exit information is > available then returning a pidfd can still be valuable for userspace as > they can retrieve exit information via PIDFD_INFO_EXIT and it really > doesn't hurt to do this. OK, agreed. I thought I missed another subtle reason. Reviewed-by: Oleg Nesterov <oleg@xxxxxxxxxx>