Re: [PATCH RFC 0/2] pidfd: add CLONE_AUTOREAP
From: Christian Brauner
Date: Tue Feb 17 2026 - 03:17:06 EST
On Mon, Feb 16, 2026 at 07:25:48AM -0800, Linus Torvalds wrote:
> On Mon, 16 Feb 2026 at 05:49, Christian Brauner <brauner@xxxxxxxxxx> wrote:
> >
> > CLONE_AUTOREAP requires CLONE_PIDFD because the process will never be
> > visible to wait().
>
> This seems an unnecessary and counter-productive limitation.
>
> The very *traditional* unix way to do auto-reaping is to fork twice,
> and have the "middle" parent just exit.
>
> That makes the final child be re-parented to init, and it is invisible
> to wait() - all very much on purpose.
>
> This was (perhaps still is?) very commonly used for starting up
> background daemons (together with disassociating from the tty etc).
>
> So I don't mind th enew flag, but I think the restriction is
> unnecessary and not logical. Sometimes you simply don't *want*
> processes visible to wait - or care about a pidfd.
I'm completely fine removing that restriction and supporting autoreap
without pidfd.