mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] mm/memfd: handle GUP references reliably when write-sealing
@ 2026-11-03 18:31 David Hildenbrand (Arm)
  2026-11-03 18:31 ` [PATCH 1/2] mm/memfd: handle GUP pins more " David Hildenbrand (Arm)
  2026-11-03 18:31 ` [PATCH 2/2] mm/memfd: handle GUP references " David Hildenbrand (Arm)
  0 siblings, 2 replies; 3+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-03 18:31 UTC (permalink / raw)
  To: Hugh Dickins, Baolin Wang, Andrew Morton, David Rheinsberg,
	Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: linux-mm, linux-kernel, linux-doc, David Hildenbrand (Arm),
	stable, Chris Mason

I spent way too much time on this, looking for better options. I think
patch #1 fixes the most immediate issues but something like patch #2 is
needed.

Long story short: someone can trigger a race such that we don't detect
GUP references when write-sealing, allowing to modify content later.

Patch #1 handles pins reliably for folios with a pincount. Patch #2
handles the remaining references, but can reject write-sealing with
populated file mappings. vm.memfd_write_seal_mapped allows restoring the
legacy behavior if needed.

All alternatives to patch #2 I tried ended up too complicated and nasty
in corner cases. We should never have allowed write-sealing with
existing file mappings.

Plenty of details in patch #2.

Did some testing on x86-64 without any surprises.

Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
David Hildenbrand (Arm) (2):
      mm/memfd: handle GUP pins more reliably when write-sealing
      mm/memfd: handle GUP references reliably when write-sealing

 Documentation/admin-guide/sysctl/vm.rst | 21 +++++++++++++++
 mm/memfd.c                              | 45 ++++++++++++++++++++++++++++++++-
 2 files changed, 65 insertions(+), 1 deletion(-)

---

base-commit: 462595652740dc45f2392dc59d9609e509ee60af

change-id: 20261102-fixes_core_2-39e59afda919

--

Cheers,

David


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 18:31 [PATCH 0/2] mm/memfd: handle GUP references reliably when write-sealing David Hildenbrand (Arm)
2026-11-03 18:31 ` [PATCH 1/2] mm/memfd: handle GUP pins more " David Hildenbrand (Arm)
2026-11-03 18:31 ` [PATCH 2/2] mm/memfd: handle GUP references " David Hildenbrand (Arm)

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®