Re: [PATCH] pid: allow pidfds for reaped tasks

From: Oleg Nesterov
Date: Fri Aug 11 2023 - 07:48:53 EST


As I said, I am not sure I understand the problem. And I know nothing
about net/ but...

On 08/07, Christian Brauner wrote:
>
> > SO_PEERPIDFD returns `EINVAL` if the peer-task was already reaped,
> > but returns a stale pidfd if the task is reaped immediately after the
> > respective alive-check.

after the quick grep it seems that SO_PEERPIDFD can simply use
__pidfd_prepare() ? We know that sk->sk_peer_pid was initialized with
task_tgid(current) and thus we know it is (was) a valid TGID pid.

The same is probably true for scm->pid and scm_pidfd_recv()...

But again, I am not familiar with this code, I can be wrong.

Oleg.