Re: [PATCH 4/5] pidfd: add CLONE_WAIT_PID

From: Oleg Nesterov
Date: Thu Jul 25 2019 - 14:05:18 EST


On 07/24, Christian Brauner wrote:
>
> If CLONE_WAIT_PID is set the newly created process will not be
> considered by process wait requests that wait generically on children
> such as:

I have to admit this feature looks a bit exotic to me...

> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -1019,6 +1019,9 @@ eligible_child(struct wait_opts *wo, bool ptrace, struct task_struct *p)
> if (!eligible_pid(wo, p))
> return 0;
>
> + if ((p->flags & PF_WAIT_PID) && (wo->wo_type != PIDTYPE_PID))
> + return 0;

Even if ptrace == T ?

This doesn't look right. Say, strace should work even if its tracee (or
one of the tracees) has PF_WAIT_PID.

Oleg.