CVE-2026-99652: mm: fix deadlock of mremap() against UFFDIO_MOVE
In the Linux kernel, the following vulnerability has been resolved:
mm: fix deadlock of mremap() against UFFDIOMOVE
With per-VMA locks, UFFDIOMOVE can run concurrently with mremap() on different VMAs in the same mm. Those VMAs can share page tables, so both operations can acquire the same pair of page-table locks.
UFFDIOMOVE orders the locks by address, while mremap() takes the source lock first. These conflicting orders can deadlock; mremap() holding mmaplock for writing no longer helps.
Move doubleptlock() and doubleptunlock() to mm/internal.h and use them for all page-table moves in mremap(). Preserve the source entry checks after acquiring both locks. Remove the comments claiming that exclusive mmaplock makes lock ordering irrelevant.
In moveptes(), make sure to just recheck source and destination PMD after taking the locks and drop the overly-long comment.
Fix generated by an LLM and sent by Chris Mason in private.
[ david: use new helpers consistently; simplify description and comments; moveptes() fixup ]
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5
Frequently Asked Questions
What conditions are required for this deadlock to occur?
The affected process must have concurrent mremap() and UFFDIO_MOVE operations running on different VMAs within the same memory map. Those VMAs must share page tables so that both operations contend for the same pair of page-table locks.
Does holding mmap_lock prevent the issue?
No. The description states that mremap() holding mmap_lock for writing no longer prevents the deadlock when per-VMA locks allow UFFDIO_MOVE to run concurrently on a different VMA in the same mm.
What is the practical impact of triggering the vulnerability?
The conflicting page-table lock acquisition order can deadlock the concurrent operations. This can leave the involved process memory-management operations blocked.
What changed in the fix?
The fix applies shared double_pt_lock() and double_pt_unlock() helpers to page-table moves in mremap(), aligning lock ordering with UFFDIO_MOVE. It also retains source-entry validation after both locks are acquired and rechecks source and destination PMDs in move_ptes().