Re: [PATCH 0/3] mm/memory: fix handling of PTE markers in insert_page_into_pte_locked()
From: David Hildenbrand (Arm)
Date: Tue Nov 17 2026 - 15:19:40 EST
On 11/17/26 20:31, Mike Rapoport wrote:
> On Tue, Nov 17, 2026 at 05:22:09PM +0100, David Hildenbrand (Arm) wrote:
>> On 11/17/26 16:58, Mike Rapoport (Microsoft) wrote:
>>> 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.
>>
>>
>> I have here a fix to disallow uffd on DAX entirely. It's completely broken.
>>
>> I was staging it to send with others, but I can send it out separately.
>
> Nah, no need.
>
> But patch 3/3 here is for MADV_GUARD_INSTALL on DAX unrelated to uffd.
Let me take a look at that tomorrow. But for 1 and 2 we should just reject uffd
registration.
--
Cheers,
David