CVE-2025-39821
Severity CVSS v4.0:
Pending analysis
Type:
CWE-787
Out-of-bounds Write
Publication date:
16/09/2025
Last modified:
14/01/2026
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
perf: Avoid undefined behavior from stopping/starting inactive events<br />
<br />
Calling pmu->start()/stop() on perf events in PERF_EVENT_STATE_OFF can<br />
leave event->hw.idx at -1. When PMU drivers later attempt to use this<br />
negative index as a shift exponent in bitwise operations, it leads to UBSAN<br />
shift-out-of-bounds reports.<br />
<br />
The issue is a logical flaw in how event groups handle throttling when some<br />
members are intentionally disabled. Based on the analysis and the<br />
reproducer provided by Mark Rutland (this issue on both arm64 and x86-64).<br />
<br />
The scenario unfolds as follows:<br />
<br />
1. A group leader event is configured with a very aggressive sampling<br />
period (e.g., sample_period = 1). This causes frequent interrupts and<br />
triggers the throttling mechanism.<br />
2. A child event in the same group is created in a disabled state<br />
(.disabled = 1). This event remains in PERF_EVENT_STATE_OFF.<br />
Since it hasn&#39;t been scheduled onto the PMU, its event->hw.idx remains<br />
initialized at -1.<br />
3. When throttling occurs, perf_event_throttle_group() and later<br />
perf_event_unthrottle_group() iterate through all siblings, including<br />
the disabled child event.<br />
4. perf_event_throttle()/unthrottle() are called on this inactive child<br />
event, which then call event->pmu->start()/stop().<br />
5. The PMU driver receives the event with hw.idx == -1 and attempts to<br />
use it as a shift exponent. e.g., in macros like PMCNTENSET(idx),<br />
leading to the UBSAN report.<br />
<br />
The throttling mechanism attempts to start/stop events that are not<br />
actively scheduled on the hardware.<br />
<br />
Move the state check into perf_event_throttle()/perf_event_unthrottle() so<br />
that inactive events are skipped entirely. This ensures only active events<br />
with a valid hw.idx are processed, preventing undefined behavior and<br />
silencing UBSAN warnings. The corrected check ensures true before<br />
proceeding with PMU operations.<br />
<br />
The problem can be reproduced with the syzkaller reproducer:
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.16 (including) | 6.16.5 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.17:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.17:rc2:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page



