From: Matthew Wilcox <willy@infradead.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Jann Horn <jannh@google.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, syzkaller-bugs@googlegroups.com,
syzbot <syzbot+8645fe63c4d22c8d27b8@syzkaller.appspotmail.com>
Subject: Re: [syzbot] [mm?] WARNING: suspicious RCU usage in mas_walk (2)
Date: Thu, 27 Jul 2023 19:46:39 +0100 [thread overview]
Message-ID: <ZMK7jwpI4uD6tKrF@casper.infradead.org> (raw)
In-Reply-To: <CAJuCfpEWfFY_JXoXDnK0X+rY6Qf==RBpLzSSJhEtgU50HHp4-A@mail.gmail.com>
On Thu, Jul 27, 2023 at 11:31:01AM -0700, Suren Baghdasaryan wrote:
> A comment for __anon_vma_prepare() says "This must be called with the
> mmap_lock held for reading."
> I think adding an explicit mmap_assert_locked() in this function would
> help catch such issues.
Would it catch them faster than syzbot?
> > +++ b/mm/memory.c
> > @@ -3197,6 +3197,12 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf)
> > struct mmu_notifier_range range;
> > int ret;
> >
> > + if (!vma->anon_vma) {
> > + // check if there are other things to undo here
> > + vma_end_read(vmf->vma);
> > + return VM_FAULT_RETRY;
> > + }
> > +
>
> This one bails out later but if the path is not taken too often I
> think it's cleaner.
OK, then I think the right place to put this check is slightly before
this function is called, to avoid bouncing the folio refcount:
+++ b/mm/memory.c
@@ -3567,6 +3567,12 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf)
return 0;
}
copy:
+ if ((vmf->flags & FAULT_FLAG_VMA_LOCK) && !vma->anon_vma) {
+ pte_unmap_unlock(vmf->pte, vmf->ptl);
+ vma_end_read(vmf->vma);
+ return VM_FAULT_RETRY;
+ }
+
/*
* Ok, we need to copy. Oh, well..
*/
... it compiles. Guess I should figure out the syntax to ask syzbot to
test it.
next prev parent reply other threads:[~2023-07-27 18:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 3:12 [syzbot] [mm?] WARNING: suspicious RCU usage in mas_walk (2) syzbot
2023-07-06 16:53 ` Liam R. Howlett
2023-07-25 20:27 ` syzbot
2023-07-26 6:57 ` syzbot
2023-07-27 16:47 ` Liam R. Howlett
[not found] ` <CAJuCfpEyE18kbH84FfmfzUnar2dxgzpi=FOYPbU8MOpz-SbVjg@mail.gmail.com>
2023-07-27 17:59 ` Jann Horn
2023-07-27 18:12 ` Liam R. Howlett
2023-07-27 18:17 ` Matthew Wilcox
2023-07-27 18:31 ` Suren Baghdasaryan
2023-07-27 18:46 ` Matthew Wilcox [this message]
2023-07-27 19:20 ` Jann Horn
2023-07-27 20:08 ` Matthew Wilcox
2023-07-27 18:50 ` Matthew Wilcox
2023-07-27 18:50 ` syzbot
2023-07-27 18:52 ` Matthew Wilcox
2023-07-27 18:53 ` syzbot
2023-07-27 18:54 ` Matthew Wilcox
2023-07-27 19:12 ` Aleksandr Nogikh
2023-07-27 18:56 ` Matthew Wilcox
2023-07-27 19:17 ` syzbot
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=ZMK7jwpI4uD6tKrF@casper.infradead.org \
--to=willy@infradead.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=surenb@google.com \
--cc=syzbot+8645fe63c4d22c8d27b8@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).