Search CVEs and advisories

Search CVEs and Linux security advisories by vendor, product, package, or severity, and see which vulnerabilities each advisory addresses.

CVE

CVE-2025-39821

published high CVSS 3.1 · 7.8

perf: Avoid undefined behavior from stopping/starting inactive events

Published
16 Sep 2025, 13:00:20 UTC
Updated
05 Aug 2026, 12:05:25 UTC
Language
en

Package status and fixes

Distro / vendorReleasePackage / productPublisher statusFixed buildSource
Linux — Linux9734e25fbf5ae68eb04234b2cd14a4b36ab89141 to < d689135aa9c5e4e0eab5a92bbe35dab0c8d6677f · 9734e25fbf5ae68eb04234b2cd14a4b36ab89141 to < b64fdd422a85025b5e91ead794db9d3ef970e369 · Other versions: unaffected Affected Not stated Linux
Linux — Linux6.16 (affected) · 0 to < 6.16 (unaffected · semver) · 6.16.5 through 6.16.* (unaffected · semver) · 6.17 and later (unaffected · original_commit_for_fix) · Other versions: affected Version-specific Not stated Linux
Amazon Linux AL2 Release evaluation Not Affected Not required Amazon Linux assessment
Amazon Linux AL2023 Release evaluation Not Affected Not required Amazon Linux assessment

Description

In the Linux kernel, the following vulnerability has been resolved: perf: Avoid undefined behavior from stopping/starting inactive events Calling pmu->start()/stop() on perf events in PERF_EVENT_STATE_OFF can leave event->hw.idx at -1. When PMU drivers later attempt to use this negative index as a shift exponent in bitwise operations, it leads to UBSAN shift-out-of-bounds reports. The issue is a logical flaw in how event groups handle throttling when some members are intentionally disabled. Based on the analysis and the reproducer provided by Mark Rutland (this issue on both arm64 and x86-64). The scenario unfolds as follows: 1. A group leader event is configured with a very aggressive sampling period (e.g., sample_period = 1). This causes frequent interrupts and triggers the throttling mechanism. 2. A child event in the same group is created in a disabled state (.disabled = 1). This event remains in PERF_EVENT_STATE_OFF. Since it hasn't been scheduled onto the PMU, its event->hw.idx remains initialized at -1. 3. When throttling occurs, perf_event_throttle_group() and later perf_event_unthrottle_group() iterate through all siblings, including the disabled child event. 4. perf_event_throttle()/unthrottle() are called on this inactive child event, which then call event->pmu->start()/stop(). 5. The PMU driver receives the event with hw.idx == -1 and attempts to use it as a shift exponent. e.g., in macros like PMCNTENSET(idx), leading to the UBSAN report. The throttling mechanism attempts to start/stop events that are not actively scheduled on the hardware. Move the state check into perf_event_throttle()/perf_event_unthrottle() so that inactive events are skipped entirely. This ensures only active events with a valid hw.idx are processed, preventing undefined behavior and silencing UBSAN warnings. The corrected check ensures true before proceeding with PMU operations. The problem can be reproduced with the syzkaller reproducer:

en · Linux · cna

Vendor advisories explicitly linked to this CVE.

0

No linked advisories were found for this CVE.

Assessment

CVSS risk assessment and additional context for this vulnerability.

CVSS version
3.1
Base score
7.8 / 10
Severity
high
Provider
Linux · cna
Vector string
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Scenarios
en: AV:L - The vulnerability is reached exclusively through the `perf_event_open(2)` syscall and `ioctl(PERF_EVENT_IOC_PERIOD)` on the resulting fd; there is no network or remote-peer input path into the perf throttling code. AC:L - The attacker fully controls both halves — the group leader's `sample_period=1` deterministically forces throttling within milliseconds, and the disabled sibling is created by the attacker; there is no race or memory-layout condition outside their influence, and the UAF window length is itself chosen via the sibling's `sample_period`. PR:L - At the mainline default `kernel.perf_event_paranoid=2`, an unprivileged local user can open a task-scoped sampling group with `exclude_kernel=1` and no capabilities (`perf_allow_kernel()` is only invoked for `!exclude_kernel`), and software cpu-clock/task-clock events need no hardware PMU, so the bug is reachable from containers and VMs. UI:N - The attacking process performs the entire sequence — create group, force throttle, wait for unthrottle, close the fds — with no action by any other user or victim process. S:U - The corruption is confined to kernel memory and PMU state within the same security authority; no hypervisor, IOMMU, or sandbox boundary is crossed. C:H - A `perf_event` is freed while its embedded `hw.hrtimer` remains enqueued on the per-CPU hrtimer base, giving a use-after-free over an attacker-timed window that can be reclaimed and read back through the timer machinery; the x86 path additionally performs an out-of-bounds `bt` read below `cpuc->active_mask`. I:H - The dangling hrtimer means `__run_hrtimer()` calls `timer->function` from reclaimed heap memory, a direct control-flow hijack primitive after a heap spray; the x86 `btr` at bit offset -1 is also an out-of-bounds bit write into the adjacent per-CPU `cpu_hw_events` pointer. A:H - Even without exploitation the bug reliably produces kernel oopses from the freed-timer dereference, and the arm64 path hits a non-`_ONCE` `WARN(1, "Invalid PMEV* index")` plus a UBSAN shift-out-of-bounds report on every trigger — an unprivileged panic under `panic_on_warn`/`ubsan_panic` and log flooding otherwise.

Additional Assessments

Additional normalized CVSS assessments
VersionScoreSeverityProviderVectorScenarios
3.1 7.8 high CISA-ADP · adp CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H —

Publisher product statements

Version ranges and default statuses as reported by each provider.

Affected vendor and product assertions
VendorProductVersion statusSource
Linux Linux 9734e25fbf5ae68eb04234b2cd14a4b36ab89141 to < d689135aa9c5e4e0eab5a92bbe35dab0c8d6677f (affected · git)9734e25fbf5ae68eb04234b2cd14a4b36ab89141 to < b64fdd422a85025b5e91ead794db9d3ef970e369 (affected · git)Default: unaffected Linux · cna
Linux Linux 6.16 (affected)0 to < 6.16 (unaffected · semver)6.16.5 through 6.16.* (unaffected · semver)6.17 and later (unaffected · original_commit_for_fix)Default: affected Linux · cna

Weaknesses

1
  • CWE-787 CWE-787 Out-of-bounds Write (CISA-ADP · adp)

References

2

Provider assertions

2

Linux · cna

perf: Avoid undefined behavior from stopping/starting inactive events

CISA-ADP · adp

CISA ADP Vulnrichment

Provenance

Schema
5.2
Searchable
yes
Content hash
3fb9c4bada61ad1a72e6121f9e494d33f27f239fb87093206ea85d1080a2da71
Ingested
23 Sep 2026, 08:47:06 UTC
Source record
Official CVE record

Search filters

Match options apply to free text. CVE words match tokens; use contains:"…" for literal substrings.

Text

Words and phrases
buffer overflow "remote code execution"
Word prefix
auth*
Literal substring (title or description)
contains:"use-after-free"
Exclude a term or filter
-test -vendor:example

Affected product

Vendor
vendor:Example
Product
product:"Demo Widget"

Severity and score

Severity · none, low, medium, high, critical, unknown
severity:critical
CWE identifier
cwe:CWE-863
CVSS score (0–10)
cvss:>=7.0

Dates and status

Published date · comparisons, relative days
published:>=2026-01-01
Updated date · comparisons, relative days
updated:<30d
Status · published (default), rejected, unknown
status:rejected