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-98540 Overview
CVE-2026-98540 is a Linux kernel vulnerability in the fprobe tracing subsystem. The flaw lives in fprobe_fgraph_entry(), which reserves shadow stack space for every fprobe that has an exit handler but populates that space only when the entry handler returns 0. Because fgraph_reserve_data() does not clear the reserved region, fprobe_return() later parses stale bytes as valid fprobe headers from an earlier call. The result is that an exit handler can execute twice, or run even when its own entry handler signaled that it should be skipped.
Critical Impact
Incorrect fgraph header parsing causes exit handlers to run unexpectedly, breaking fprobe semantics and risking inconsistent kernel tracing state.
Affected Products
- Linux kernel versions containing the fprobe and fgraph shadow stack reservation logic
- Distributions shipping the vulnerable kernel/trace/fprobe.c code path prior to commits 1d653a1 and b7459fd
- Systems using fprobe-based tracing, BPF tracing, or ftrace graph instrumentation
Discovery Timeline
- 2026-10-18 - CVE-2026-98540 published to NVD
- 2026-10-19 - Last updated in NVD database
Technical Details for CVE-2026-98540
Vulnerability Analysis
The fprobe infrastructure uses the function graph tracer's shadow stack to pass per-call state between entry and exit handlers. fprobe_fgraph_entry() walks every registered fprobe with an exit handler and reserves a slot via fgraph_reserve_data(), but it writes a valid header into that slot only when the entry handler returns 0. Slots belonging to fprobes whose entry handlers return non-zero remain uninitialized.
On return, fprobe_return() iterates the reserved region and decodes each slot as an fprobe header. Because the reservation routine does not zero memory, the uninitialized tail still contains header bytes from a previous activation of the same stack region. The decoder treats those stale values as live entries and invokes the referenced exit handlers.
Root Cause
The root cause is a missing terminator in the fgraph data list combined with reliance on reused shadow stack memory. On architectures that pack the fprobe header into a single unsigned long, arch_decode_fprobe_header_fp() ORs in FPROBE_HEADER_MSB_PATTERN, so a zeroed slot does not naturally decode to a NULL fprobe pointer. Without an explicit sentinel, the walker has no reliable way to detect the end of valid entries.
Attack Vector
This is a kernel correctness bug reachable through fprobe or BPF-based tracing workloads that register probes with exit handlers. Local users with the ability to attach fprobes can trigger duplicate or spurious exit handler invocations. The practical impact is tracing state corruption, incorrect telemetry, and potential follow-on misbehavior in subsystems that depend on balanced entry and exit callbacks.
The upstream fix writes a zero word after the last populated entry to terminate the walk, and modifies read_fprobe_header() to return NULL for a zeroed slot so the terminator is honored even on architectures that encode the header in a single unsigned long. See the kernel commits 1d653a1 and b7459fd for the patch details.
Detection Methods for CVE-2026-98540
Indicators of Compromise
- Duplicate invocations of fprobe exit handlers for the same traced function call
- Exit handlers executing despite the paired entry handler returning a non-zero skip value
- Unexpected imbalance in entry/exit counters inside BPF or ftrace-based observability tooling
Detection Strategies
- Audit kernel build versions against the fixing commits 1d653a1 and b7459fd to identify unpatched hosts
- Review workloads that register fprobes with exit handlers for anomalous callback counts
- Compare /proc/version and distribution kernel changelogs against vendor advisories referencing this fix
Monitoring Recommendations
- Monitor telemetry derived from fprobe or BPF tracers for inconsistent event pairs
- Alert on new fprobe attachments from unexpected processes using Linux audit rules
- Track kernel package upgrades across the fleet to confirm patch rollout coverage
How to Mitigate CVE-2026-98540
Immediate Actions Required
- Apply the stable kernel update that includes commits 1d653a1 and b7459fd as soon as vendor packages are available
- Restrict CAP_SYS_ADMIN and BPF/tracing capabilities to trusted administrative users
- Inventory systems where fprobe-based tracing is enabled in production and prioritize them for patching
Patch Information
The fix is delivered through two upstream kernel commits: Kernel Git Commit 1d653a1 and Kernel Git Commit b7459fd. The patches terminate the fgraph_data list with a zero word and update read_fprobe_header() to return NULL for zeroed slots. Consume the fix through your Linux distribution's stable kernel update channel.
Workarounds
- Disable fprobe-based tracing workloads on unpatched kernels where feasible
- Limit unprivileged BPF and tracing access via kernel.unprivileged_bpf_disabled=1 and tightened perf_event_paranoid settings
- Remove or restrict tooling that dynamically attaches fprobes with exit handlers until the kernel is updated
# Configuration example: restrict unprivileged tracing on unpatched hosts
sysctl -w kernel.unprivileged_bpf_disabled=1
sysctl -w kernel.perf_event_paranoid=3
sysctl -w kernel.kptr_restrict=2
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

