CVE-2026-98116: ALSA: pcm: Serialize PCM mmap with buffer reallocation to fix page UAF
In the Linux kernel, the following vulnerability has been resolved:
ALSA: pcm: Serialize PCM mmap with buffer reallocation to fix page UAF
sndpcmhwparams() and sndpcmhwfree() guard buffer reallocation with an mmapcount check performed under the PCM stream lock, but the lock is released long before the buffer is actually freed: sndpcmsyncstop(), constraint refinement and dofreepages() all happen in between. sndpcmmmapdata(), on the other hand, takes no lock at all: it validates against the old buffer's state and dmabytes, remaps its pages into the VMA, and only then increments mmapcount.
A concurrent mmap() can therefore slip in between the check and the free. remappfnrange() installs writable PTEs for the old buffer's pages without taking page references, and the subsequent dofreepages() returns those pages to the page allocator while the VMA still maps them. This leaves a stale, writable mapping of freed pages: a page-level use-after-free that can be leveraged for local privilege escalation.
Make sndpcmmmapdata() participate in the buffer-access scheme introduced for hwparams/hwfree: acquire runtime->bufferaccessing before validating and remapping, and release it afterwards. Buffer reallocation already fails with -EBUSY while accessors are active, and the mmap side now fails with -EBUSY while a reallocation is in progress, so the validate/remap sequence and the check/free sequence can no longer interleave.
A reproducer that turns this race into a stale writable mapping of the freed DMA buffer pages is available on request.
Affected Software
Event History
Frequently Asked Questions
What level of access would an attacker need?
The issue is described as usable for local privilege escalation. Exploitation requires triggering a race involving PCM memory mapping while the PCM buffer is being reallocated or freed.
What is the security consequence of winning the race?
A successful race can leave a writable user mapping to pages that have been returned to the page allocator. This is a page-level use-after-free that can be leveraged to elevate privileges locally.
Which operations are involved in the vulnerable race?
The race occurs when snd_pcm_mmap_data() maps PCM buffer pages concurrently with snd_pcm_hw_params() or snd_pcm_hw_free() reallocating or freeing that buffer. The mapping could be installed after the reallocation/free path checks mmap_count but before the old pages are actually freed.