On 03/06, Christian Brauner wrote: > > Back when we implemented support for PIDFD_THREAD we ended up with the > decision that if userspace holds: > > pidfd_leader_thread = pidfd_open(<thread-group-leader-pid>, PIDFD_THREAD) > > that exit notification is not strictly defined if a non-thread-group > leader thread execs: Yes, this was even documented in commit 64bef697d33b ... > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -745,8 +745,11 @@ static void exit_notify(struct task_struct *tsk, int group_dead) > /* > * sub-thread or delay_group_leader(), wake up the > * PIDFD_THREAD waiters. > + * > + * The thread-group leader will be taken over by the execing > + * task so don't cause spurious wakeups. > */ > - if (!thread_group_empty(tsk)) > + if (!thread_group_empty(tsk) && (tsk->signal->notify_count >= 0)) > do_notify_pidfd(tsk); > > if (unlikely(tsk->ptrace)) { perhaps... but this won't help if the leader exits and that another thread does exec?