linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jann Horn <jannh@google.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Jann Horn <jannh@google.com>,
	 syzbot <syzbot+c2e5712cbb14c95d4847@syzkaller.appspotmail.com>,
	 akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org,  lorenzo.stoakes@oracle.com,
	syzkaller-bugs@googlegroups.com, vbabka@suse.cz
Subject: Re: [syzbot] [mm?] KCSAN: data-race in mprotect_fixup / try_to_migrate_one
Date: Wed, 5 Feb 2025 16:52:22 +0100	[thread overview]
Message-ID: <CAG48ez0raDom84xznCGkmtJ+afz74zzgdhUSMZD41QJPCBkP4g@mail.gmail.com> (raw)
In-Reply-To: <tuqu4yuub5mj627dobasbiy4hbtkuvrk5gyqqf5zynli2t7xod@jxxjoworr7tp>

On Wed, Feb 5, 2025 at 4:47 PM Liam R. Howlett <Liam.Howlett@oracle.com> wrote:
> * Jann Horn <jannh@google.com> [250205 10:00]:
> > The comments in the VMA flags code incorrectly assume that no
> > concurrency is possible here; and I think the comment in
> > mprotect_fixup() about protection by the mmap_lock has also been kinda
> > wrong since the beginning of git history.
> >
> > The VM_LOCKED check in the migration code was added by Hugh in commit
> > b74355078b655, but that's just one example syzbot stumbled over; we
> > have similar racy vm_flags reads through the rmap on other paths like:
> >
> > unmap_mapping_range_tree -> unmap_mapping_range_vma ->
> > zap_page_range_single -> unmap_single_vma -> unmap_page_range -> ...
> > -> zap_pte_range -> zap_present_ptes -> vm_normal_page
>
> I think we need a list of vm_area_struct parts that are OK to access
> without the read/write/vma lock.  It seems flags is not one of those as
> it could be racy.

We do have this big table in these nice docs that Lorenzo spent quite
some effort on:
https://kernel.org/doc/html/latest/mm/process_addrs.html#vma-fields

Though that does not currently call out this possible concurrency of vm_flags.


  reply	other threads:[~2025-02-05 15:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 11:41 syzbot
2025-02-05 15:00 ` Jann Horn
2025-02-05 15:11   ` Lorenzo Stoakes
2025-02-05 15:14     ` Jann Horn
2025-02-05 15:46     ` Marco Elver
2025-02-05 15:51       ` Lorenzo Stoakes
2025-02-05 16:25         ` Marco Elver
2025-02-05 18:56           ` Liam R. Howlett
2025-02-05 18:59           ` Lorenzo Stoakes
2025-02-05 15:47   ` Liam R. Howlett
2025-02-05 15:52     ` Jann Horn [this message]
2025-02-05 15:07 ` Lorenzo Stoakes
2025-02-05 15:14   ` Jann Horn
2025-02-05 15:34     ` Lorenzo Stoakes

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=CAG48ez0raDom84xznCGkmtJ+afz74zzgdhUSMZD41QJPCBkP4g@mail.gmail.com \
    --to=jannh@google.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=syzbot+c2e5712cbb14c95d4847@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=vbabka@suse.cz \
    /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