All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,usama.anjum@arm.com,rppt@kernel.org,
	peterx@redhat.com,pankaj.gupta@amd.com,mason@kernel.org,gourry@gourry.net,
	azpijr@gmail.com,1045704958@qq.com,david@kernel.org,akpm@linux-foundation.org
Subject: + mm-userfaultfd-reject-dax-mappings.patch added to mm-new branch
Date: Tue, 24 Nov 2026 01:50:41 -0800	[thread overview]
Message-ID: <20261124095042.24EE51F000E6@smtp.kernel.org> (raw)
In-Reply-To: <20261118-dax_uffd-v1-1-d776cca1ae17@kernel.org>


The patch titled
     Subject: mm/userfaultfd: reject DAX mappings
has been added to the -mm mm-new branch.  Its filename is
     mm-userfaultfd-reject-dax-mappings.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-userfaultfd-reject-dax-mappings.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: "David Hildenbrand (Arm)" <david@kernel.org>
Subject: mm/userfaultfd: reject DAX mappings
Date: Wed, 18 Nov 2026 11:03:00 +0100

UFFD_FEATURE_WP_ASYNC made DAX mappings eligible for userfaultfd
write-protection, but the DAX fault paths have never fully supported it.

DAX faults use vmf_insert_mixed() and vmf_insert_mixed_mkwrite(), which
treats any non-empty PTE, including uffd-wp markers, as an existing
mapping.  A read fault on an uffd-wp marker therefore returns
VM_FAULT_NOPAGE without replacing the marker, causing the fault to repeat
indefinitely.

PAGEMAP_SCAN can also write-protect a DAX PMD, but the huge DAX
write-fault path can make it writable without clearing its uffd-wp bit,
breaking async write tracking.

Device DAX mappings requiring huge-page alignment and cannot serve PTE
faults after UFFDIO_WRITEPROTECT has split their huge mappings.

So let's just disallow DAX mappings in vma_can_userfault() entirely,
making UFFDIO_REGISTER fail with EINVAL.

Link: https://patch.msgid.link/20261118-dax_uffd-v1-1-d776cca1ae17@kernel.org
Fixes: d61ea1cb0095 ("userfaultfd: UFFD_FEATURE_WP_ASYNC")
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Chris Mason <mason@kernel.org>
Reported-by: Jingyi Sun <1045704958@qq.com>
Closes: https://lore.kernel.org/all/tencent_1874C71D4177A1624528043E008DB1A5EF05@qq.com
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Reviewed-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Muhammad Usama Anjum <usama.anjum@arm.com>

 mm/userfaultfd.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/mm/userfaultfd.c~mm-userfaultfd-reject-dax-mappings
+++ a/mm/userfaultfd.c
@@ -2156,6 +2156,9 @@ static bool vma_can_userfault(struct vm_
 	/* Only mm-backed memory can have its faults handled by userspace. */
 	if (!vma_is_mm_backed(vma))
 		return false;
+	/* DAX fault handlers do not support uffd-wp. */
+	if (vma_is_dax(vma))
+		return false;
 	/* Core mm may discard droppable memory at any time. */
 	if (vma_test_single_mask(vma, VMA_DROPPABLE))
 		return false;
_

Patches currently in -mm which might be from david@kernel.org are

mm-mprotect-dont-skip-uffd-marker-install-when-racing-with-pte-table-reclaim.patch
mm-khugepaged-free-unused-page-table-when-setting-a-huge-pmd-fails.patch
mm-userfaultfd-prevent-poison-marker-loss.patch
mm-hugetlb-compare-against-persistent-count-when-freeing-lowmem-folios.patch
mm-hugetlb-preserve-reservations-when-shrinking-on-highmem.patch
mm-hugetlb-account-temporary-folios-separately.patch
mm-hugetlb-account-temporary-folios-separately-fix.patch
mm-hugetlb-serialize-page-cache-allocations-with-truncation.patch
mm-hugetlb-serialize-page-cache-allocations-with-truncation-fix.patch
mm-memfd-recheck-the-page-cache-before-allocating-a-hugetlb-folio.patch
mm-hugetlb-count-again-if-the-reserve-map-shrank.patch
mm-hugetlb-account-restored-reservations-before-freeing-folios.patch
mm-hugetlb-delay-anon-folio-rmap-removal-until-after-the-tlb-flush.patch
mm-userfaultfd-reject-dax-mappings.patch


      parent reply	other threads:[~2026-11-24  9:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 10:03 [PATCH] mm/userfaultfd: reject DAX mappings David Hildenbrand (Arm)
2026-11-18 14:12 ` Gregory Price (Meta)
2026-11-18 14:58 ` Mike Rapoport
2026-11-18 22:14 ` Jose A. Perez de Azpillaga
2026-11-19 12:11 ` Gupta, Pankaj
2026-11-19 12:23   ` David Hildenbrand (Arm)
2026-11-24  9:50 ` Andrew Morton [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=20261124095042.24EE51F000E6@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=1045704958@qq.com \
    --cc=azpijr@gmail.com \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=mason@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=pankaj.gupta@amd.com \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.org \
    --cc=usama.anjum@arm.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.