Skip to main content
Vulnerability Database/CVE-2026-97587

CVE-2026-97587: Linux Kernel RISC-V Buffer Overflow Flaw

CVE-2026-97587 is a buffer overflow vulnerability in the Linux kernel RISC-V performance monitoring subsystem that causes out-of-bounds memory access on 32-bit systems. This article covers technical details, impact, and fixes.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-97587 Overview

CVE-2026-97587 is a Linux kernel vulnerability in the RISC-V performance monitoring (perf) subsystem. The available-counter mask was declared as a single unsigned long, while iteration logic uses RISCV_MAX_COUNTERS, which is defined as 64. On RV32 systems where unsigned long is 32 bits, the iterator reads memory past the allocated object. Setting bits at index 32 and above also corrupts adjacent memory. The fix replaces the single unsigned long with DECLARE_BITMAP and uses set_bit and bitmap helpers across event checking, index allocation, and counter stop paths.

Critical Impact

Out-of-bounds memory read and incorrect bit manipulation in the RISC-V perf subsystem on 32-bit systems, potentially leading to kernel information disclosure or corruption of adjacent kernel data.

Affected Products

  • Linux kernel on RISC-V 32-bit (RV32) architecture
  • Kernel builds using the RISC-V perf subsystem with SBI PMU extension
  • Virtualized RV32 environments such as qemu-system-riscv32

Discovery Timeline

  • 2026-09-25 - CVE CVE-2026-97587 published to NVD
  • 2026-09-25 - Last updated in NVD database

Technical Details for CVE-2026-97587

Vulnerability Analysis

The RISC-V perf driver tracked available hardware counters using a single unsigned long bitmask. Iteration loops throughout the driver walked up to RISCV_MAX_COUNTERS (64) entries when evaluating event matches, allocating counter indices, and stopping counters. On RV64, where unsigned long is 64 bits, the storage was coincidentally large enough. On RV32, where unsigned long is 32 bits, every iteration beyond bit 31 reads adjacent kernel memory.

The condition also affects write paths. Writing bits at index 32 or higher into a 32-bit storage word produced undefined behavior and failed to represent counters above the first word. Testing on qemu-system-riscv32 confirmed that the hardware probe bitmap exposes counter bits above XLEN, so relying on a single word misses available counters and corrupts neighboring state.

Root Cause

The root cause is a size mismatch between storage width (unsigned long) and iteration bound (RISCV_MAX_COUNTERS = 64). The declaration did not use DECLARE_BITMAP, which would have sized the allocation to the number of bits required. This classifies as an Out-of-Bounds Read combined with an Out-of-Bounds Write on 32-bit RISC-V builds.

Attack Vector

Exploitation requires local access to a RISC-V system running an affected kernel. The perf subsystem is reachable through the standard perf_event_open syscall interface, which is typically accessible to unprivileged users depending on kernel.perf_event_paranoid settings. An attacker performing counter allocation or event matching can trigger the out-of-bounds access path. No public proof-of-concept exploit is available at this time.

Technical details are available in the upstream kernel commits: Kernel Commit 143668c4, Kernel Commit 6809da6e, Kernel Commit 9bec7bea, and Kernel Commit e5481db3.

Detection Methods for CVE-2026-97587

Indicators of Compromise

  • Unexpected kernel warnings or KASAN reports originating in the RISC-V perf driver, specifically around CFG_MATCH handling and counter index allocation paths.
  • Anomalous perf counter allocation failures or incorrect event-to-counter mappings on RV32 kernels.

Detection Strategies

  • Build affected RV32 kernels with KASAN enabled to surface the out-of-bounds read when running perf workloads.
  • Audit kernel version strings on RISC-V hosts and compare against patched stable branches referenced in the upstream commits.
  • Monitor syscall telemetry for perf_event_open activity by non-root processes on RISC-V endpoints.

Monitoring Recommendations

  • Collect kernel ring buffer messages (dmesg) and ingest into a centralized logging pipeline to catch KASAN or WARN output from the perf subsystem.
  • Track perf_event_paranoid sysctl values across the fleet to identify RISC-V systems where unprivileged perf access is permitted.
  • Baseline normal perf counter usage per host and alert on deviations that correlate with the vulnerable code paths.

How to Mitigate CVE-2026-97587

Immediate Actions Required

  • Apply the upstream kernel patches referenced in the four stable commits to any RV32 kernel build in production or test.
  • Rebuild and redeploy RISC-V kernel images for QEMU, embedded, and bare-metal targets after merging the fix.
  • Restrict unprivileged perf access by setting kernel.perf_event_paranoid to 3 on affected systems until patches are deployed.

Patch Information

The upstream fix replaces the unsigned long counter mask with DECLARE_BITMAP and uses set_bit and bitmap iteration helpers in event matching, index allocation, and counter stop paths. The counter base is computed as i * BITS_PER_LONG, and a helper consolidates the CFG_MATCH SBI ecall to avoid duplicating the 32-bit argument split. See Kernel Commit 143668c4 for the primary change and the related stable backports.

Workarounds

  • Disable the RISC-V SBI PMU driver in kernel configuration if performance counters are not required on affected RV32 builds.
  • Restrict perf subsystem access to privileged users by raising kernel.perf_event_paranoid using sysctl.
  • Limit exposure of RV32 workloads to trusted local users until a patched kernel is deployed.
bash
# Restrict unprivileged access to the perf subsystem
sudo sysctl -w kernel.perf_event_paranoid=3
echo 'kernel.perf_event_paranoid=3' | sudo tee /etc/sysctl.d/99-perf-restrict.conf

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.