Skip to content
Unverified Commit 0c9bd6bc authored by Tycho Andersen's avatar Tycho Andersen Committed by Christian Brauner
Browse files

pidfd: getfd should always report ESRCH if a task is exiting



We can get EBADF from pidfd_getfd() if a task is currently exiting,
which might be confusing. Let's check PF_EXITING, and just report ESRCH
if so.

I chose PF_EXITING, because it is set in exit_signals(), which is called
before exit_files(). Since ->exit_status is mostly set after
exit_files() in exit_notify(), using that still leaves a window open for
the race.

Reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarTycho Andersen <tandersen@netflix.com>
Link: https://lore.kernel.org/r/20240206192357.81942-1-tycho@tycho.pizza


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 83b290c9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment