[PATCH v3 0/3] mm/hugetlb: fix mremap bugs

From: Li Zhe

Date: Wed Oct 21 2026 - 23:47:03 EST


This series fixes a few hugetlb mremap bugs.

Patch 1 fixes the return type of move_hugetlb_page_tables(), so large
hugetlb moves cannot be truncated when reported back to the generic
mremap code.

Patch 2 disables hugetlb PMD sharing for UFFD missing mode, so
UFFDIO_POISON markers cannot become visible through shared PMD page
tables.

Patch 3 fixes the recursive i_mmap_rwsem deadlock in the hugetlb mremap
path by avoiding the destination PMD sharing allocation path while the
mapping lock is already held for write.

David Hildenbrand (Arm) (1):
mm/hugetlb: disable PMD sharing for UFFD missing mode

Li Zhe (2):
mm/hugetlb: fix mremap move length truncation
mm/hugetlb: fix mremap deadlock when PMD sharing is possible

include/linux/hugetlb.h | 15 ++++------
include/linux/userfaultfd_k.h | 16 ++--------
mm/hugetlb.c | 55 ++++++++++++++++++++++++++---------
3 files changed, 50 insertions(+), 36 deletions(-)

---
v2: https://lore.kernel.org/all/20261019113034.97690-1-lizhe.67@xxxxxxxxxxxxx/
v1: https://lore.kernel.org/all/20260930064308.58159-1-lizhe.67@xxxxxxxxxxxxx/

Changes since v2:

- Add Cc: stable@xxxxxxxxxxxxxxx to patch 1, as suggested by David.
- Use double-tab indentation for move_hugetlb_page_tables(), as
suggested by David.
- Disable hugetlb PMD sharing based on the userfaultfd context instead
of checking individual UFFD mode flags, as suggested by Mike.

--
2.20.1