mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
pidfd_poll: report POLLHUP when pid_task() == NULL
Add another wake_up_all(wait_pidfd) into __change_pid() and change pidfd_poll() to include EPOLLHUP if task == NULL. This allows to wait until the target process/thread is reaped. TODO: change do_notify_pidfd() to use the keyed wakeups. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Link: https://lore.kernel.org/r/20240202131226.GA26018@redhat.com Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
64bef697d3
commit
43f0df54c9
@@ -349,6 +349,11 @@ static void __change_pid(struct task_struct *task, enum pid_type type,
|
||||
hlist_del_rcu(&task->pid_links[type]);
|
||||
*pid_ptr = new;
|
||||
|
||||
if (type == PIDTYPE_PID) {
|
||||
WARN_ON_ONCE(pid_has_task(pid, PIDTYPE_PID));
|
||||
wake_up_all(&pid->wait_pidfd);
|
||||
}
|
||||
|
||||
for (tmp = PIDTYPE_MAX; --tmp >= 0; )
|
||||
if (pid_has_task(pid, tmp))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user