From: Matthew Wilcox <willy@infradead.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jann Horn <jannh@google.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>,
Suren Baghdasaryan <surenb@google.com>
Subject: Re: linux-next: manual merge of the mm tree with Linus' tree
Date: Fri, 28 Jul 2023 00:49:50 +0100 [thread overview]
Message-ID: <ZMMCnvc3h7XT/NM2@casper.infradead.org> (raw)
In-Reply-To: <20230728091849.7f32259d@canb.auug.org.au>
On Fri, Jul 28, 2023 at 09:18:49AM +1000, Stephen Rothwell wrote:
> diff --cc mm/memory.c
> index ca632b58f792,271982fab2b8..000000000000
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@@ -5392,32 -5597,18 +5597,21 @@@ retry
> if (!vma)
> goto inval;
>
> - /* Only anonymous and tcp vmas are supported for now */
> - if (!vma_is_anonymous(vma) && !vma_is_tcp(vma))
> - /* find_mergeable_anon_vma uses adjacent vmas which are not locked */
> - if (vma_is_anonymous(vma) && !vma->anon_vma)
> -- goto inval;
> --
> if (!vma_start_read(vma))
> goto inval;
>
> + /*
> + * find_mergeable_anon_vma uses adjacent vmas which are not locked.
> + * This check must happen after vma_start_read(); otherwise, a
> + * concurrent mremap() with MREMAP_DONTUNMAP could dissociate the VMA
> + * from its anon_vma.
> + */
> - if (unlikely(!vma->anon_vma && !vma_is_tcp(vma)))
> - goto inval_end_read;
> -
> - /*
> - * Due to the possibility of userfault handler dropping mmap_lock, avoid
> - * it for now and fall back to page fault handling under mmap_lock.
> - */
> - if (userfaultfd_armed(vma))
> ++ if (unlikely(vma_is_anonymous(vma) && !vma_is_tcp(vma)))
> + goto inval_end_read;
> +
No, this isn't right. It should be:
if (unlikely(vma_is_anonymous(vma) && !vma->anon_vma))
goto inval_end_read;
I'm not sure about the userfaultfd_armed() clause. My patch wasn't
intended to affect that.
> /* Check since vm_start/vm_end might change before we lock the VMA */
> - if (unlikely(address < vma->vm_start || address >= vma->vm_end)) {
> - vma_end_read(vma);
> - goto inval;
> - }
> + if (unlikely(address < vma->vm_start || address >= vma->vm_end))
> + goto inval_end_read;
>
> /* Check if the VMA got isolated after we found it */
> if (vma->detached) {
next prev parent reply other threads:[~2023-07-27 23:50 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 23:18 linux-next: manual merge of the mm tree with Linus' tree Stephen Rothwell
2023-07-27 23:29 ` Stephen Rothwell
2023-07-27 23:40 ` Suren Baghdasaryan
2023-07-27 23:50 ` Matthew Wilcox
2023-07-28 0:08 ` Suren Baghdasaryan
2023-07-28 0:00 ` Stephen Rothwell
2023-07-28 3:13 ` Matthew Wilcox
2023-07-27 23:49 ` Matthew Wilcox [this message]
2023-07-28 0:21 ` Stephen Rothwell
2023-07-28 0:23 ` Suren Baghdasaryan
2023-07-28 0:29 ` Stephen Rothwell
2023-07-28 0:30 ` Suren Baghdasaryan
-- strict thread matches above, loose matches on Subject: below --
2025-02-09 22:39 Stephen Rothwell
2024-09-29 23:56 Stephen Rothwell
2024-09-30 6:01 ` Miguel Ojeda
2024-09-16 23:27 Stephen Rothwell
2024-09-17 23:40 ` Stephen Rothwell
2024-09-09 0:00 Stephen Rothwell
2024-09-09 1:53 ` Huang, Ying
2024-09-17 23:36 ` Stephen Rothwell
2024-07-28 22:41 Stephen Rothwell
2024-07-28 22:45 ` Stephen Rothwell
2024-07-28 23:31 ` Andrew Morton
2024-05-09 23:22 Stephen Rothwell
2023-07-06 22:54 Stephen Rothwell
2023-07-07 4:52 ` Baoquan He
2023-06-18 23:23 Stephen Rothwell
2023-06-19 20:25 ` Andrew Morton
2023-06-19 20:43 ` Will Deacon
2023-06-19 21:39 ` Andrew Morton
2023-06-20 9:43 ` Will Deacon
2023-06-20 15:00 ` Jain, Ayush
2023-02-24 23:39 Stephen Rothwell
2023-02-25 2:04 ` Andrew Morton
2023-02-25 7:13 ` Christian Brauner
2023-02-25 20:52 ` Andrew Morton
2023-02-27 10:18 ` Christian Brauner
2023-02-27 17:55 ` Andrew Morton
2022-11-07 2:52 Stephen Rothwell
2022-09-06 9:01 Stephen Rothwell
2022-09-06 9:21 ` Rolf Eike Beer
2022-05-26 6:09 Stephen Rothwell
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=ZMMCnvc3h7XT/NM2@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=surenb@google.com \
--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