# CVE-2024-26796: drivers: perf: ctr\_get\_width function for legacy is not defined

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.31% (percentile 16, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2024-04-04T08:20:25.823Z
- **Modified:** 2026-06-17T07:18:22.150Z

## Who should check

- Anyone running Linux \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< e0d17ee872cf8d0f51cc561329b8e1a0aa792bbb; \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< e4f50e85de5a6b21dfdc0d7ca435eba4f62935c3; \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< 682dc133f83e0194796e6ea72eb642df1c03dfbe
- Anyone running Linux 6.6

## Description

In the Linux kernel, the following vulnerability has been resolved:

drivers: perf: ctr\_get\_width function for legacy is not defined

With parameters CONFIG\_RISCV\_PMU\_LEGACY=y and CONFIG\_RISCV\_PMU\_SBI=n
linux kernel crashes when you try perf record:

$ perf record ls
\[ 46.749286\] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
\[ 46.750199\] Oops \[\#1\]
\[ 46.750342\] Modules linked in:
\[ 46.750608\] CPU: 0 PID: 107 Comm: perf-exec Not tainted 6.6.0 \#2
\[ 46.750906\] Hardware name: riscv-virtio,qemu (DT)
\[ 46.751184\] epc : 0x0
\[ 46.751430\] ra : arch\_perf\_update\_userpage+0x54/0x13e
\[ 46.751680\] epc : 0000000000000000 ra : ffffffff8072ee52 sp : ff2000000022b8f0
\[ 46.751958\] gp : ffffffff81505988 tp : ff6000000290d400 t0 : ff2000000022b9c0
\[ 46.752229\] t1 : 0000000000000001 t2 : 0000000000000003 s0 : ff2000000022b930
\[ 46.752451\] s1 : ff600000028fb000 a0 : 0000000000000000 a1 : ff600000028fb000
\[ 46.752673\] a2 : 0000000ae2751268 a3 : 00000000004fb708 a4 : 0000000000000004
\[ 46.752895\] a5 : 0000000000000000 a6 : 000000000017ffe3 a7 : 00000000000000d2
\[ 46.753117\] s2 : ff600000028fb000 s3 : 0000000ae2751268 s4 : 0000000000000000
\[ 46.753338\] s5 : ffffffff8153e290 s6 : ff600000863b9000 s7 : ff60000002961078
\[ 46.753562\] s8 : ff60000002961048 s9 : ff60000002961058 s10: 0000000000000001
\[ 46.753783\] s11: 0000000000000018 t3 : ffffffffffffffff t4 : ffffffffffffffff
\[ 46.754005\] t5 : ff6000000292270c t6 : ff2000000022bb30
\[ 46.754179\] status: 0000000200000100 badaddr: 0000000000000000 cause: 000000000000000c
\[ 46.754653\] Code: Unable to access instruction at 0xffffffffffffffec.
\[ 46.754939\] ---\[ end trace 0000000000000000 \]---
\[ 46.755131\] note: perf-exec\[107\] exited with irqs disabled
\[ 46.755546\] note: perf-exec\[107\] exited with preempt\_count 4

This happens because in the legacy case the ctr\_get\_width function was not
defined, but it is used in arch\_perf\_update\_userpage.

Also remove extra check in riscv\_pmu\_ctr\_get\_width\_mask

## Affected and fixed versions

- Linux: \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< e0d17ee872cf8d0f51cc561329b8e1a0aa792bbb; \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< e4f50e85de5a6b21dfdc0d7ca435eba4f62935c3; \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< 682dc133f83e0194796e6ea72eb642df1c03dfbe (cvelist)
- Linux: 6.6 (cvelist)

## Mitigation

- Upgrade Linux to 682dc133f83e0194796e6ea72eb642df1c03dfbe or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-26796. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-26796.md
Affected: Linux >= cc4c07c89aada16229084eeb93895c95b7eabaa3, < e0d17ee872cf8d0f51cc561329b8e1a0aa792bbb; >= cc4c07c89aada16229084eeb93895c95b7eabaa3, < e4f50e85de5a6b21dfdc0d7ca435eba4f62935c3; >= cc4c07c89aada16229084eeb93895c95b7eabaa3, < 682dc133f83e0194796e6ea72eb642df1c03dfbe; Linux 6.6
Fixed in: Linux 682dc133f83e0194796e6ea72eb642df1c03dfbe

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-26796 being exploited?

There is no confirmed exploitation: CVE-2024-26796 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.31% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-26796?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-26796?

Linux \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< e0d17ee872cf8d0f51cc561329b8e1a0aa792bbb; \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< e4f50e85de5a6b21dfdc0d7ca435eba4f62935c3; \>= cc4c07c89aada16229084eeb93895c95b7eabaa3, \< 682dc133f83e0194796e6ea72eb642df1c03dfbe; Linux 6.6.

### Is there a fix for CVE-2024-26796?

Yes. Fixed in Linux 682dc133f83e0194796e6ea72eb642df1c03dfbe. Upgrade Linux to 682dc133f83e0194796e6ea72eb642df1c03dfbe or later.

### How do I check if I'm affected by CVE-2024-26796?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/e0d17ee872cf8d0f51cc561329b8e1a0aa792bbb>
- patch: <https://git.kernel.org/stable/c/e4f50e85de5a6b21dfdc0d7ca435eba4f62935c3>
- patch: <https://git.kernel.org/stable/c/682dc133f83e0194796e6ea72eb642df1c03dfbe>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-26796>

HTML: <https://flawdb.com/CVE-2024-26796> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-26796>
