From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Jann Horn <jannh@google.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH RFC v3 1/4] clone: add CLONE_AUTOREAP
Date: Wed, 18 Feb 2026 12:25:26 +0100 [thread overview]
Message-ID: <aZWhpo7-1a0ChJMN@redhat.com> (raw)
In-Reply-To: <20260217-work-pidfs-autoreap-v3-1-33a403c20111@kernel.org>
On 02/17, Christian Brauner wrote:
>
> CLONE_AUTOREAP can be combined with CLONE_PIDFD to allow the parent to
> monitor the child's exit via poll() and retrieve exit status via
> PIDFD_GET_INFO. Without CLONE_PIDFD it provides a fire-and-forget
> pattern where the parent simply doesn't care about the child's exit
> status. No exit signal is delivered so exit_signal must be zero.
^^^^^^^^^^^^^^^^^^^^^^^^
Well, it has no effect if signal->autoreap is true. Probably makes
sense to enforce this rule anyway... but see below.
> @@ -2028,6 +2028,13 @@ __latent_entropy struct task_struct *copy_process(
> return ERR_PTR(-EINVAL);
> }
>
> + if (clone_flags & CLONE_AUTOREAP) {
> + if (clone_flags & CLONE_THREAD)
> + return ERR_PTR(-EINVAL);
> + if (args->exit_signal)
> + return ERR_PTR(-EINVAL);
> + }
> +
> /*
> * Force any signals received before this point to be delivered
> * before the fork happens. Collect up signals sent to multiple
> @@ -2374,6 +2381,8 @@ __latent_entropy struct task_struct *copy_process(
> p->parent_exec_id = current->parent_exec_id;
> if (clone_flags & CLONE_THREAD)
> p->exit_signal = -1;
> + else if (clone_flags & CLONE_AUTOREAP)
> + p->exit_signal = 0;
So this is only needed for the CLONE_PARENT|CLONE_AUTOREAP case. Do we
really need to support this case? Not that I see anything wrong, but let
me ask anyway.
OTOH, what if a CLONE_AUTOREAP'ed child does clone(CLONE_PARENT) ?
in this case args->exit_signal is ignored, so the new child will run
with exit_signal == 0 but without signal->autoreap. This means it will
become a zombie without sending a signal. Again, I see nothing really
wrong, just this looks a bit confusing to me.
Oleg.
next prev parent reply other threads:[~2026-02-18 11:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-17 22:35 [PATCH RFC v3 0/4] pidfd: add CLONE_AUTOREAP and CLONE_PIDFD_AUTOKILL Christian Brauner
2026-02-17 22:35 ` [PATCH RFC v3 1/4] clone: add CLONE_AUTOREAP Christian Brauner
2026-02-18 11:25 ` Oleg Nesterov [this message]
2026-02-18 13:30 ` Christian Brauner
2026-02-17 22:35 ` [PATCH RFC v3 2/4] pidfd: add CLONE_PIDFD_AUTOKILL Christian Brauner
2026-02-17 23:17 ` Linus Torvalds
2026-02-17 23:38 ` Jann Horn
2026-02-17 23:44 ` Linus Torvalds
2026-02-18 8:18 ` Christian Brauner
2026-02-18 14:00 ` Theodore Tso
2026-02-18 13:29 ` Theodore Tso
2026-02-18 10:21 ` Christian Brauner
2026-02-17 23:43 ` Jann Horn
2026-02-18 10:00 ` Christian Brauner
2026-02-18 11:50 ` Oleg Nesterov
2026-02-18 13:31 ` Christian Brauner
2026-02-17 22:35 ` [PATCH RFC v3 3/4] selftests/pidfd: add CLONE_AUTOREAP tests Christian Brauner
2026-02-17 22:35 ` [PATCH RFC v3 4/4] selftests/pidfd: add CLONE_PIDFD_AUTOKILL tests Christian Brauner
2026-02-17 22:46 ` [PATCH RFC v3 0/4] pidfd: add CLONE_AUTOREAP and CLONE_PIDFD_AUTOKILL Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZWhpo7-1a0ChJMN@redhat.com \
--to=oleg@redhat.com \
--cc=brauner@kernel.org \
--cc=jannh@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox