CVE-2026-99703: mm/hugetlb: fix mremap deadlock when PMD sharing is possible
In the Linux kernel, the following vulnerability has been resolved:
mm/hugetlb: fix mremap deadlock when PMD sharing is possible
movehugetlbpagetables() holds the mapping's immaprwsem for write while moving hugetlb PTEs. This prevents races with truncation and protects hugepmdunshare(), but the move loop must not call helpers that can acquire the same rwsem for read.
hugeptealloc() can do that when the destination can use PMD sharing: it may call hugepmdshare(), which takes immaprwsem for read while searching for a shareable PMD table. Calling it while the move path already holds immaprwsem for write can deadlock.
Avoid that path for PMD-sized hugetlb mappings that can use PMD sharing. Instead of allocating or sharing the destination page table while moving, zap the source range and let the destination fault path populate or share the PMD lazily.
Reuse the hugetlb unmap logic for the source-side zap by splitting the core loop out of unmaphugepagerange(). The wrapper keeps the existing tlbstartvma(), tlbendvma() and hugepmdunshareflush() behavior, while movehugetlbpagetables() can reuse the unmap loop with its existing mmugather.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.64 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5
Frequently Asked Questions
What conditions are required to trigger the deadlock?
The issue requires an mremap operation involving PMD-sized hugetlb mappings where PMD sharing is possible. The move path must attempt to allocate or share a destination page table while it already holds the mapping's i_mmap_rwsem for write.
What is the operational impact?
The affected move path can deadlock because huge_pte_alloc() may invoke huge_pmd_share(), which attempts to acquire i_mmap_rwsem for read while the same path holds it for write. This can cause the mremap operation to stop making progress.
What changes in the resolved implementation?
For eligible PMD-sized hugetlb mappings, the move path no longer allocates or shares the destination page table. It zaps the source range and allows a later fault on the destination to populate or share the PMD lazily.