Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shawn Shao" <shawnq1@163.com>,
	akpm@linux-foundation.org, rppt@kernel.org, peterx@redhat.com
Cc: linux-mm@kvack.org
Subject: Re: [PATCH] mm/userfaultfd: validate context for range operations
Date: Thu, 03 Dec 2026 13:26:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-247856@kernel.org> (raw)
In-Reply-To: <20261202131600.3164107-1-shawnq1@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm/userfaultfd: inaccurate Fixes trailer for validate_dst_vma()
  fill check
--

commit 43228c9ac2ba9eef695cbebd4847d45be3edba16
Author: Shawn Shao <shawnq1@163.com>

> mm/userfaultfd: validate context for range operations
>
> Hello,
>
> userfaultfd range operations locate destination VMAs through ctx->mm, but
> they do not consistently verify that the VMA is registered through the
> context issuing the operation. A fill or protection operation can therefore
> cross the VMA's context boundary and can route a fault wakeup through a
> different context.
>
> Require an exact context match in the shared fill validation and in the
> write-protect and read-write-protect range walks. Keep the same validation
> on the hugetlb fill retry path.
>
> HEAD commit:    693c2e04e3f1d4c59af236e1211b7b8cb165a790
> git tree:       c2ddff65ad678839e4004d5e4f7f5d28aadd0e80
> source version: Linux 7.4.0-rc5
> architecture:   x86-64
> compiler:       gcc 11.4.0, GNU ld 2.38
>
> The issue reproduces on Linux 7.4.0-rc4 at commit
> 7cd8495c0f16275c4f9abe1cef09a7b5fcd6d046, with git tree
> 194227446ae61b4971eea1b7bed06856fe3cc477. The affected code is present in
> the HEAD revision above. The patch was built and tested on that revision.
>
> A source reproducer and positive/control results are available for private
> review.
>
> Fixes: 86039bd3b4e6 ("userfaultfd: add new syscall to provide memory externalization")
> Fixes: ffd05793963a ("userfaultfd: wp: support write protection for userfault vma range")
> Fixes: 6eab8f2cc646 ("userfaultfd: add UFFDIO_REGISTER_MODE_RWP and UFFDIO_RWPROTECT plumbing")
> Signed-off-by: Shawn Shao <shawnq1@163.com>

[Severity: Low]
86039bd3b4e6 ("userfaultfd: add new syscall to provide memory
externalization") only introduced fs/userfaultfd.c without mm/userfaultfd.c
or any fill operations.  The !dst_vma->vm_userfaultfd_ctx.ctx fill check in
mm/userfaultfd.c was introduced in c1a4de99fada ("userfaultfd:
mcopy_atomic|mfill_zeropage: UFFDIO_COPY|UFFDIO_ZEROPAGE preparation") and
exposed to userspace in ad465cae96b4 ("userfaultfd: UFFDIO_COPY and
UFFDIO_ZEROPAGE").

Should the first Fixes: tag reference c1a4de99fada ("userfaultfd:
mcopy_atomic|mfill_zeropage: UFFDIO_COPY|UFFDIO_ZEROPAGE preparation") (or
ad465cae96b4 ("userfaultfd: UFFDIO_COPY and UFFDIO_ZEROPAGE")) instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202131600.3164107-1-shawnq1@163.com?part=1


      reply	other threads:[~2026-12-03 13:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 13:16 [PATCH] mm/userfaultfd: validate context for range operations Shawn Shao
2026-12-03 13:26 ` sashiko-bot [this message]

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=sashiko-outbox-247856@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shawnq1@163.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