KernelScan.io

HIGH

perf RingBuffer Race

CVE-2026-23248

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI6.6MEDIUM

01

In the Linux kernel, the following vulnerability has been resolved: perf/core: Fix refcount bug and potential UAF in perf_mmap Syzkaller reported a refcount_t: addition on 0; use-after-free warning in perf_mmap. The issue is caused by a race condition between a failing mmap() setup and a concurrent mmap() on a dependent event (e.g., using output redirection). In perf_mmap(), the ring_buffer (rb) is allocated and assigned to event->rb with the mmap_mutex held. The mutex is then released to perform map_range(). If map_range() fails, perf_mmap_close() is called to clean up. However, since the mutex was dropped, another thread attaching to this event (via inherited events or output redirection) can acquire the mutex, observe the valid event->rb pointer, and attempt to increment its reference count. If the cleanup path has already dropped the reference count to zero, this results in a use-after-free or refcount saturation warning. Fix this by extending the scope of mmap_mutex to cover the map_range() call. This ensures that the ring buffer initialization and mapping (or cleanup on failure) happens atomically effectively, preventing other threads from accessing a half-initialized or dying ring buffer.

02

Engine v0.2.0

Risk summary

A race condition in the perf subsystem can lead to a use-after-free on a ring buffer during mmap operations. A local attacker can trigger the race by concurrently mapping a dependent event while a prior mmap setup fails, resulting in refcount corruption on a freed object. This can be leveraged for kernel memory corruption and potential privilege escalation.

Affectedkernel/events/core.c (perf subsystem)

Vulnerability analysis

The vulnerability exists in perf_mmap(), where the mmap_mutex is released after assigning a newly allocated ring_buffer to event->rb but before the map_range() call completes. If map_range() fails, perf_mmap_close() begins cleanup and drops the ring buffer's reference count. Because the mutex was dropped, a concurrent thread can acquire it, observe the dangling event->rb pointer, and attempt to increment its reference count—operating on a freed object. The fix extends the mutex scope to cover map_range() and its failure cleanup, ensuring that no thread can access a half-initialized or dying ring buffer.

03

BranchFixed inPatch commit
6.186.18.17c27dea9f50ed
6.196.19.7ac7ecb65af17
mainline7.077de62ad3de3