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

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

CVE-2026-97937 is a use-after-free flaw in the Linux kernel ftrace subsystem that causes memory corruption during process forking. This post explains its technical details, affected versions, and mitigation steps.

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

CVE-2026-97937 is a use-after-free vulnerability in the Linux kernel's ftrace function graph tracer. The flaw occurs during process forking when ftrace_graph_init_task() runs after copy_exec_state() in dup_task_struct(). If copy_exec_state() fails for non-CLONE_VM forks, the cleanup path calls ftrace_graph_exit_task() on the child, which still holds the parent's ret_stack pointer. This frees the parent's active function graph return stack, causing the parent to access freed memory from function_graph_enter_regs(). KASAN detected the slab-use-after-free during kernel testing.

Critical Impact

A local attacker with the ability to trigger fork failures while function graph tracing is active can corrupt kernel memory, potentially leading to privilege escalation or denial of service.

Affected Products

  • Linux kernel (upstream, pre-patch builds containing the ftrace function graph fork path)
  • Distributions shipping affected stable kernel branches
  • Systems with CONFIG_FUNCTION_GRAPH_TRACER enabled

Discovery Timeline

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

Technical Details for CVE-2026-97937

Vulnerability Analysis

The vulnerability resides in the kernel's process creation path, specifically in copy_process(). When a new task is created, dup_task_struct() performs a shallow copy of the parent's task_struct, which includes the ret_stack pointer used by the function graph tracer to record return addresses.

The function ftrace_graph_init_task() is responsible for clearing this copied state and allocating fresh tracing structures for the child. However, this initialization executed after copy_exec_state(), which performs memory allocations that can fail. When copy_exec_state() fails on a non-CLONE_VM fork, execution jumps to the bad_fork_free label and calls free_task(). That cleanup invokes ftrace_graph_exit_task() on a child that still carries the parent's ret_stack pointer, freeing memory that the parent continues to use.

Root Cause

The root cause is an ordering flaw [CWE-416] in the fork error-handling path. The child task's function graph state remains aliased to the parent's until ftrace_graph_init_task() runs. Any fallible operation between dup_task_struct() and that initialization can trigger cleanup that frees parent-owned structures. The fix moves ftrace_graph_init_task() to execute immediately after dup_task_struct(), before any operation that can fail.

Attack Vector

Exploitation requires local access and the ability to invoke clone() or fork() syscalls under conditions that cause copy_exec_state() allocation to fail. An attacker enables function graph tracing on a target process, then induces memory pressure or resource limits to force the child allocation failure. The subsequent free of the parent's ret_stack creates a dangling pointer accessed on the next traced function call. KASAN output confirms the write of size 8 occurs at the freed slab address during function_graph_enter_regs+0xa76/0xb90.

No public proof-of-concept exploit is listed in the enriched data. Refer to the upstream commits for the complete patch diff.

Detection Methods for CVE-2026-97937

Indicators of Compromise

  • KASAN splats referencing function_graph_enter_regs with slab-use-after-free reports
  • Kernel oops or panic traces originating in ftrace_graph_func after a failed copy_process call
  • Unexpected process crashes on hosts actively using the function graph tracer

Detection Strategies

  • Enable KASAN on test and staging kernels to surface use-after-free conditions in ftrace paths
  • Correlate kernel ring buffer messages with process fork failures using centralized log collection
  • Audit systems where tracing_on is enabled with function_graph as the current tracer

Monitoring Recommendations

  • Forward /var/log/kern.log and dmesg output to a SIEM for pattern matching on KASAN and ftrace stack traces
  • Monitor fork failure rates and OOM events on hosts running debugging or tracing workloads
  • Track kernel version inventory to confirm patched builds are deployed across the fleet

How to Mitigate CVE-2026-97937

Immediate Actions Required

  • Apply the upstream kernel patches referenced in the stable tree commits 08cacffeef8f and 1fadebbbf31f
  • Rebuild and deploy patched kernels on systems where function graph tracing is used operationally
  • Restrict access to /sys/kernel/debug/tracing to root and trusted operators only

Patch Information

The fix initializes the child's function graph state immediately after dup_task_struct() and before the first fallible operation in copy_process(). See the Kernel Git Commit 08cacffeef8f and the Kernel Git Commit 1fadebbbf31f for the complete upstream fix. Distribution vendors should backport these commits to supported stable branches.

Workarounds

  • Disable function graph tracing by writing nop to /sys/kernel/debug/tracing/current_tracer on affected hosts
  • Remove CONFIG_FUNCTION_GRAPH_TRACER from kernel builds where tracing is not required
  • Mount debugfs with restrictive permissions to prevent unprivileged tracing configuration changes
bash
# Configuration example
# Disable function graph tracer at runtime
echo nop > /sys/kernel/debug/tracing/current_tracer
echo 0 > /sys/kernel/debug/tracing/tracing_on

# Restrict access to tracing interface
chmod 700 /sys/kernel/debug/tracing

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.