CVE-2026-99477: fs/proc/task_mmu: pin mm_users in do_pagemap_scan()
In the Linux kernel, the following vulnerability has been resolved:
fs/proc/taskmmu: pin mmusers in dopagemapscan()
The PAGEMAPSCAN ioctl takes mmapreadlock() on an mm obtained from /proc/<pid>/pagemap without holding a reference to mmusers.
procmemopen() deliberately grabs only mmcount, so a consumer that touches the address space has to call mmgetnotzero() first. Every other consumer in this file does -- mstart(), doprocmapquery(), showsmapsrollup() and pagemapread() -- but dopagemapscan() does not.
Without that reference the target can reach exitmmap() concurrently, and exitmmap() calls unmapvmas() while holding mmaplock only for reading, which does not exclude the scanner. For ordinary VMAs this is harmless, as freepgtables() and removevma() run afterwards under mmapwritelock. A shared hugetlb VMA is different: hugetlbzapend() frees the VMA's hugetlbvmalock inside the read-locked phase.
walkhugetlbrange() can therefore load vma->vmprivatedata, have the lock freed underneath it, and then downread() a freed rwsemaphore. The load happens before the freeing side clears the pointer, so this is a use-after-free and not a NULL dereference. Any unprivileged user can reach it with no huge pages configured, as hugetlbreservepages() allocates the lock before the VMNORESERVE early return.
Pin mmusers across the scan, the way the other consumers do. mmput() from the exiting task can then no longer reach exitmmap() while a walk is in progress.
[akpm@linux-foundation.org: remove unneeded & undesirable test for !mm]
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.12.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.61 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.2 - Compensating control
Pin mm_users across the PAGEMAP_SCAN scan so the target cannot reach exit_mmap() while the scan is in progress.