From: Oleg Nesterov <oleg@redhat.com>
To: Nickolai Zeldovich <nickolai@csail.mit.edu>
Cc: Christian Brauner <brauner@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] exit: fix lost-update race on the child_subreaper bitfields
Date: Sun, 11 Oct 2026 14:09:16 +0200 [thread overview]
Message-ID: <ast8bJdwDYBnGRT7@redhat.com> (raw)
In-Reply-To: <20261009222404.760787-1-nickolai@csail.mit.edu>
On 10/09, Nickolai Zeldovich wrote:
>
> is_child_subreaper, has_child_subreaper and autoreap are 1-bit fields
> that share one word of struct signal_struct. A store to any of them is
> a read-modify-write of the whole word, and two of the stores run
> without a common lock:
Yes, thanks, this is obviously wrong. But I am a bit confused...
> autoreap is only written to
> a not yet published signal_struct in copy_process() and is not racy by
> itself,
Yes,
> but it shares the word and is converted with the other two.
So why? If you turn the *_child_subreaper members to bool, then
autoreap:1 is fine?
Oleg.
> --- a/include/linux/sched/signal.h
> +++ b/include/linux/sched/signal.h
> @@ -130,9 +130,9 @@ struct signal_struct {
> * process will inherit a flag if they should look for a
> * child_subreaper process at exit.
> */
> - unsigned int is_child_subreaper:1;
> - unsigned int has_child_subreaper:1;
> - unsigned int autoreap:1;
> + bool is_child_subreaper;
> + bool has_child_subreaper;
> + bool autoreap;
next prev parent reply other threads:[~2026-10-11 12:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 22:24 Nickolai Zeldovich
2026-10-11 12:09 ` Oleg Nesterov [this message]
2026-10-11 12:34 ` Nickolai Zeldovich
2026-10-11 12:34 ` [PATCH v2] " Nickolai Zeldovich
2026-10-11 14:24 ` Oleg Nesterov
2026-10-12 8:39 ` 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=ast8bJdwDYBnGRT7@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickolai@csail.mit.edu \
/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
all inboxes | Powered by JetHome®