[PATCH 0/3] mm/memory: fix handling of PTE markers in insert_page_into_pte_locked()

From: Mike Rapoport (Microsoft)

Date: Tue Nov 17 2026 - 10:58:45 EST


Jingyi reported that a uffd-wp marker in a DAX mapping causes endless
refaults on reads and SIGBUS on writes [1].

The root cause is that insert_page_into_pte_locked() treats every PTE that
is not none as a present mapping. Besides uffd-wp markers, this also
affects guard markers that MADV_GUARD_INSTALL can put into a DAX mapping
concurrently with a write fault.

The first patch restructures insert_page_into_pte_locked() to make room
for the fixes, the second patch fixes the reported issue and the third
makes write faults back off on non-present PTEs.

Both issues were reproduced on ext4 with dax=always on emulated pmem, and
the fixes were verified with these reproducers.
selftests.

[1] https://lore.kernel.org/all/tencent_1874C71D4177A1624528043E008DB1A5EF05@xxxxxx

---
Mike Rapoport (Microsoft) (3):
mm/memory: install new PTEs first in insert_page_into_pte_locked()
mm/memory: replace uffd-wp markers in insert_page_into_pte_locked()
mm/memory: don't upgrade non-present PTEs in insert_page_into_pte_locked()

mm/memory.c | 68 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 35 insertions(+), 33 deletions(-)
---
base-commit: 93d7a816a2df3e907e2719bd12b0073f1285fc5c
change-id: 20261117-uffd-dax-async-wp-fix-867acc8dc78f

--
Sincerely yours,
Mike.