CVE-2026-99928: mm/hugetlb: don't clear the resv_map of a VMA whose lock is held
In the Linux kernel, the following vulnerability has been resolved:
mm/hugetlb: don't clear the resvmap of a VMA whose lock is held
Since commit bf4916922c60 ("hugetlbfs: extend hugetlbvmalock to private VMAs") the lock of a private hugetlb VMA that owns a reservation is the rwsema of its resvmap. The hugetlbvmalock() helpers find it through vma->vmprivatedata, anew for every lock and every unlock.
At the end of mremap() the old VMA has to let go of the resvmap, which now belongs to the new VMA: clearvmaresvhugepages() stores NULL into vmprivatedata. mremap() holds mmaplock for writing and has write locked the VMA, which keeps away everybody who comes through the mm. It does not keep away those who find the VMA through the file. For hole punch and truncation hugetlbvmdeletelist() does
hugetlbvmatrylockwrite(vma); locks resvmap->rwsema unmaphugepagerange(vma, ...); vmprivatedata = NULL hugetlbvmaunlockwrite(vma); no resvmap: does nothing
and the rwsema stays write locked for ever:
WARNING: lock held when returning to user space! mremappunch/116 is leaving the kernel with locks still held! locks held by mremappunch/116: 1, last CPU#1: #0: (&resvmap->rwsema){+.+.}-{4:4}, at: hugetlbvmdeletelist+0x46/0x160
The next fault in the new VMA sleeps in hugetlbvmalockread(), uninterruptibly, and it holds its entry of hugetlbfaultmutextable[]. That table is global, so a fault of any other process on a page that hashes to the same entry sleeps uninterruptibly as well.
All those who take the lock of a private VMA without taking the mmap/vma lock are affected: rmap walks. So hold immaprwsem around the clearing of the resvmap.
No change of behaviour, other than that mremap() of a hugetlb VMA takes immaprwsem once more.
Original fix generated by an LLM and sent in private by Josef.
[david: avoid local variable, move and refine comment, description cleanups+simplifications]
Affected Software
Event History
Frequently Asked Questions
Which workloads are exposed to this issue?
The affected path involves a private hugetlb VMA that owns a reservation and is remapped with mremap(). Exposure requires a concurrent hole-punch or truncation path that locates the VMA through its backing file rather than through the process memory map.
What is the observable impact if the race occurs?
The reservation map rw_sema can remain write-locked indefinitely after vm_private_data is cleared. The kernel may report a warning about returning to user space with locks still held.
How can I tell whether this has already occurred?
Check kernel warnings for messages indicating that a task is leaving the kernel with locks still held, such as a lock held by an mremap-related task. The diagnostic described for this issue identifies the held lock as the reservation map rw_sema.