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

CVE-2026-97921: Linux Kernel Use-After-Free Vulnerability

CVE-2026-97921 is a use-after-free flaw in the Linux kernel tracing subsystem that causes memory leaks when histogram triggers with invalid modifiers are rejected. This article covers technical details, impact, and mitigation.

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-97921 Overview

CVE-2026-97921 is a memory leak in the Linux kernel's tracing subsystem, specifically in the histogram trigger implementation. When a hist trigger is written with a value or variable that carries a modifier not permitted in that context, the kernel rejects the request but fails to free the fields allocated during parsing. Each rejected write leaks the allocations tied to the parsed field, including nested operand allocations for modifiers such as .log2.

Critical Impact

Repeated rejected histogram trigger writes exhaust kernel memory. Testing with CONFIG_DEBUG_KMEMLEAK showed 200 rejected writes left 332 unreferenced objects totaling 63,744 bytes.

Affected Products

  • Linux kernel (upstream) with the tracing/histogram trigger subsystem enabled
  • Distributions shipping kernels containing commit e0213434fe3e ("tracing: Do not let histogram values have some modifiers")
  • Systems with CONFIG_HIST_TRIGGERS enabled

Discovery Timeline

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

Technical Details for CVE-2026-97921

Vulnerability Analysis

The vulnerability resides in __create_val_field() within the kernel's tracing histogram code. The function obtains a hist_field from parse_expr() and only stores it into hist_data->fields[] after validating modifier flags. When a value or variable field carries a disallowed modifier, the code jumps to the err label before the store occurs. The error path returns without freeing the parsed field.

The downstream cleanup chain create_hist_data() → destroy_hist_data() → destroy_hist_fields() iterates over fields[] to free resources. Because the rejected field was never inserted into that array, it becomes unreachable and leaks on every rejected trigger write.

Root Cause

Commit e0213434fe3e restructured the modifier check from a fall-through that set ret = -EINVAL and still stored the field, into separate value and variable cases that each goto err before the store. The pre-change behavior left the field owned by fields[] so it was later freed by the normal destruction path. The restructuring eliminated that cleanup side effect without introducing an explicit free, producing a classic memory leak [CWE-401].

Attack Vector

Exploitation requires local access with permission to write to the tracing subsystem, typically under /sys/kernel/debug/tracing/events/. A local user repeatedly writes a hist trigger containing a disallowed modifier combination, for example hist:keys=prev_pid:vals=next_pid.log2 on sched_switch. Each write is rejected with -EINVAL but leaks two allocations because create_hist_field() wraps a plain field inside the operands[0] slot of the .log2 field. Sustained writes drive kernel memory exhaustion and denial of service.

See the upstream fix in Kernel Git Commit 230234d and related backports Kernel Git Commit 891c21f, Kernel Git Commit b22dc0a, and Kernel Git Commit e787361.

Detection Methods for CVE-2026-97921

Indicators of Compromise

  • Repeated -EINVAL returns from writes to events/*/*/trigger files containing hist: directives with modifiers such as .log2, .buckets, or .syscall on values or variables.
  • Unreferenced kernel object reports from /sys/kernel/debug/kmemleak originating in create_hist_field() or related tracing symbols.
  • Steady, unexplained growth of kernel slab allocations tied to the tracing subsystem on systems where histogram triggers are rarely used.

Detection Strategies

  • Audit shell history and process execution for writes to tracefs trigger files that include histogram syntax, especially from non-root service accounts with CAP_SYS_ADMIN.
  • Enable CONFIG_DEBUG_KMEMLEAK in non-production kernels and correlate leaks reporting create_hist_field() call stacks with hist trigger write activity.
  • Monitor /proc/meminfoSlab and SUnreclaim counters for abnormal growth on hosts that expose tracefs to local users or containers.

Monitoring Recommendations

  • Collect auditd rules on /sys/kernel/debug/tracing and /sys/kernel/tracing write operations and ship the events to a central analytics platform.
  • Alert on sustained write loops to trigger endpoints by any single process ID or user session.
  • Baseline kernel memory consumption and alert on sustained upward drift that lacks a workload-driven explanation.

How to Mitigate CVE-2026-97921

Immediate Actions Required

  • Apply the upstream kernel fix or the vendor-backported package containing commits 230234d, 891c21f, b22dc0a, or e787361.
  • Restrict access to tracefs and debugfs so that only trusted administrators can write to histogram trigger files.
  • Review container and sandbox configurations to confirm tracefs is not mounted writable inside untrusted workloads.

Patch Information

The fix replaces the leaking goto err paths in __create_val_field() with calls to destroy_hist_field() on the rejected field before returning. destroy_hist_field() is used rather than __destroy_hist_field() so that operands[0], which holds the inner plain field for compound modifiers such as .log2, is also freed. The function returns early for HIST_FIELD_FL_VAR_REF operands, which is correct because a rejected top-level field never carries the var-ref flag. See Kernel Git Commit 230234d for the authoritative patch.

Workarounds

  • Unmount or remount tracefs and debugfs read-only on systems that do not require live tracing: mount -o remount,ro /sys/kernel/tracing.
  • Remove CAP_SYS_ADMIN from service accounts that do not require kernel tracing capabilities.
  • Disable CONFIG_HIST_TRIGGERS in custom kernel builds where histogram triggers are not needed.
bash
# Configuration example
# Restrict tracefs access to root only
chmod 700 /sys/kernel/tracing
chmod 700 /sys/kernel/debug/tracing 2>/dev/null

# Remount tracefs read-only where tracing is not required
mount -o remount,ro /sys/kernel/tracing

# Verify applied kernel version includes the fix
uname -r

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.