mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	 David Hildenbrand <david@kernel.org>
Cc: Jan Kara <jack@suse.cz>, Jingyi Sun <1045704958@qq.com>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	 Matthew Wilcox <willy@infradead.org>,
	Michal Hocko <mhocko@suse.com>,  Mike Rapoport <rppt@kernel.org>,
	Muhammad Usama Anjum <usama.anjum@arm.com>,
	 Peter Xu <peterx@redhat.com>,
	Suren Baghdasaryan <surenb@google.com>,
	 Vlastimil Babka <vbabka@kernel.org>,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	nvdimm@lists.linux.dev
Subject: [PATCH 0/3] mm/memory: fix handling of PTE markers in insert_page_into_pte_locked()
Date: Tue, 17 Nov 2026 17:58:31 +0200	[thread overview]
Message-ID: <20261117-uffd-dax-async-wp-fix-v1-0-c9a30f27f452@kernel.org> (raw)

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@qq.com

---
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.


             reply	other threads:[~2026-11-17 15:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 15:58 Mike Rapoport (Microsoft) [this message]
2026-11-17 15:58 ` [PATCH 1/3] mm/memory: install new PTEs first " Mike Rapoport (Microsoft)
2026-11-17 15:58 ` [PATCH 2/3] mm/memory: replace uffd-wp markers " Mike Rapoport (Microsoft)
2026-11-17 15:58 ` [PATCH 3/3] mm/memory: don't upgrade non-present PTEs " Mike Rapoport (Microsoft)
2026-11-17 16:22 ` [PATCH 0/3] mm/memory: fix handling of PTE markers " David Hildenbrand (Arm)

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=20261117-uffd-dax-async-wp-fix-v1-0-c9a30f27f452@kernel.org \
    --to=rppt@kernel.org \
    --cc=1045704958@qq.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=jack@suse.cz \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=peterx@redhat.com \
    --cc=surenb@google.com \
    --cc=usama.anjum@arm.com \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.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

all inboxes | Powered by JetHome®