All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Muhammad Haris Awan <m.harisawan@icloud.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>,
	 Peter Zijlstra <peterz@infradead.org>,
	Kees Cook <kees@kernel.org>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	 Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	 Michal Hocko <mhocko@suse.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	 Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	 Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	 Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] fork: mark memcpy() in dup_mm() with data_race()
Date: Tue, 17 Nov 2026 13:02:38 +0000	[thread overview]
Message-ID: <avxPvfV4NxKL58ZR@gremlin> (raw)
In-Reply-To: <f75945f7-82bc-4ff2-92ac-9ec057347a41@kernel.org>

On Tue, Nov 17, 2026 at 11:54:28AM +0100, David Hildenbrand (Arm) wrote:
> On 11/17/26 11:24, Muhammad Haris Awan wrote:
> > Hi David,
> >
> > Reclaim isn't touching the new mm being initialized (which isn't added to
> > mm_list->fifo until lru_gen_add_mm() at the end of copy_process()).
>
> Oh, that makes sense.
>
> >
> > The KCSAN read is on oldmm inside dup_mm()'s memcpy(mm, oldmm, sizeof(*mm)):
> > oldmm is an already-live mm sitting on mm_list->fifo, so when an adjacent
> > exiting mm calls lru_gen_del_mm(), list_del_init() updates
> > oldmm->lru_gen.list.next/.prev under mm_list->lock.
> > > Since oldmm is live, lru_gen_del_mm() has to update those list pointers.
> > The alternatives in dup_mm() would be taking mm_list->lock (plus
> > mmlist_lock) during fork, or avoiding copying oldmm->lru_gen / oldmm->mmlist
> > (awkward because struct mm_struct uses __randomize_layout). Wrapping the

The focus on __randomize_layout is really weird. What, were you assuming you
could avoid it by using offsetof() or something? That'd be an awful solution
anyway?

> > memcpy() in data_race() avoids locking on fork and matches dup_vma() in
> > mm/vma_init.c.

(BTW this reads like it's an AI-generated reply... sigh.)

_My_ LLM says that lock thing wouldn't work without really fiddly changes as it
relies on memcg and you'd have to double-check a concurrent change didn't take
place and etc.

All to silence a once-in-4-year KCSAN report...

>
> Yeah, the only concern I have is that this is the big hammer for any members,
> not just the ones where we expect races.
>
> We hold the mmap lock in write mode, so one would assume that nothing can rally
> modify it. Well, besides these list exceptions.
>
> Let's see what others have to say, but I guess this is fine then, although a bit
> suboptimal.

Replied, but this for me is far from fine, since it means that we basically no
longer have any KCSAN protection against most of what fork does.

Since it's 1 report in 4 years, I think we can just live without it. And I don't
really trust the submitter to not try to slop some broken alternative solution.

>
> --
> Cheers,
>
> David

--
Cheers, Lorenzo

  reply	other threads:[~2026-11-17 13:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  5:59 [PATCH] fork: mark memcpy() in dup_mm() with data_race() Muhammad Haris Awan
2026-11-17  8:59 ` David Hildenbrand (Arm)
2026-11-17 10:24   ` Muhammad Haris Awan
2026-11-17 10:54     ` David Hildenbrand (Arm)
2026-11-17 13:02       ` Lorenzo Stoakes (ARM) [this message]
2026-11-17 14:26         ` Muhammad Haris Awan
2026-11-17 12:58 ` Lorenzo Stoakes (ARM)
2026-11-17 16:23 ` Bradley Morgan

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=avxPvfV4NxKL58ZR@gremlin \
    --to=ljs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bsegall@google.com \
    --cc=david@kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kees@kernel.org \
    --cc=kprateek.nayak@amd.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=m.harisawan@icloud.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=vbabka@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.