CVE-2026-99669: mm/huge_memory: fix truncate racing with PMD zapping
In the Linux kernel, the following vulnerability has been resolved:
mm/hugememory: fix truncate racing with PMD zapping
zaphugepmdfolio() removes the rmap before calling foliomarkdirty(). If this was the last mapping, truncation can skip unmapping the folio and proceed without waiting for the PMD lock, racing with dirtying.
ifssetrangedirty() can oops if MADVDONTNEED races with ftruncate() on XFS, when we get the folio set dirty after it was found to not be mapped anymore.
Move foliomarkdirty() and foliomarkaccessed() before rmap removal, matching the PTE zap path. This keeps the folio mapped while updating its state, so truncation must wait for the page table lock.
Fix generated by an LLM and sent by Chris Mason in private.
[ david: simplify comment and description ]
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.11 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.16 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.2 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.7 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.13 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.19 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.5-1
Event History
Frequently Asked Questions
What workload pattern can trigger the failure?
The reported failure involves MADV_DONTNEED racing with ftruncate() on XFS. The race occurs while a huge-page PMD mapping is being zapped and the folio is being marked dirty.
What is the observable impact if the race occurs?
ifs_set_range_dirty() can oops after the folio is marked dirty even though it was already found to be unmapped.