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

CVE-2026-98642: Linux Kernel BPF Use-After-Free Vulnerability

CVE-2026-98642 is a use-after-free vulnerability in the Linux kernel BPF memory allocator that enables race conditions during concurrent list operations. This article covers technical details, system impact, and mitigation strategies.

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

CVE-2026-98642 is a use-after-free (UAF) vulnerability in the Linux kernel's BPF memory allocator (bpf memalloc). The flaw involves concurrent consumption of the waiting_for_gp_ttrace and free_by_rcu_ttrace lists inside alloc_bulk(). Syzkaller fuzzing repeatedly triggered KASAN slab-use-after-free splats originating in llist_del_first() under kernel/bpf/memalloc.c. The race occurs after the RCU Tasks Trace grace period expires, when __free_rcu() runs without synchronization against concurrent alloc_bulk() consumers. A secondary race also exists on free_by_rcu_ttrace during bpf_mem_alloc_destroy(). The kernel maintainers resolved both races by introducing a raw spinlock to serialize access to the affected lists.

Critical Impact

Concurrent access to BPF ttrace lists can corrupt kernel memory, enabling local attackers with BPF privileges to trigger kernel memory corruption and potential privilege escalation.

Affected Products

  • Linux kernel builds containing the bpf memalloc subsystem prior to the referenced stable commits
  • Distributions shipping affected mainline and long-term support (LTS) kernels
  • Systems with unprivileged BPF enabled or workloads leveraging BPF map allocations

Discovery Timeline

  • 2026-10-18 - CVE-2026-98642 published to NVD
  • 2026-10-19 - Last updated in NVD database

Technical Details for CVE-2026-98642

Vulnerability Analysis

The vulnerability resides in alloc_bulk() within kernel/bpf/memalloc.c. The function consumes nodes from the lockless list waiting_for_gp_ttrace using llist_del_first(). After the RCU Tasks Trace grace period expires, the __free_rcu_tasks_trace() callback invokes llist_del_all() on the same list without any synchronization against in-flight alloc_bulk() consumers.

The race window opens between the smp_load_acquire(&head->first) and the READ_ONCE(entry->next) operations inside the llist_del_first() cmpxchg loop. If the freeing CPU reclaims the node between these two reads, the subsequent dereference of entry->next reads freed slab memory, producing the KASAN slab-use-after-free report.

A second, theoretical race affects free_by_rcu_ttrace. When bpf_mem_alloc_destroy() sets c->draining = true and do_call_rcu_ttrace() on another CPU drains the list via llist_del_all(), a concurrent alloc_bulk() on a third CPU can observe already-freed nodes.

Root Cause

Both races stem from the assumption that lockless list consumers and the RCU Tasks Trace reclaim path cannot run concurrently. In practice, no synchronization primitive enforced that invariant, and llist_del_first() is not safe against a concurrent llist_del_all() on the same list.

Attack Vector

Exploitation requires local code execution with the ability to invoke BPF syscalls that drive map allocations through bpf_mem_refill(). An attacker races BPF allocation operations against RCU Tasks Trace callback execution to corrupt freed slab objects. Successful exploitation typically yields kernel memory corruption suitable for privilege escalation primitives. See the upstream patches (commit 1c21452, commit a0e150a) for the exact synchronization fix.

Detection Methods for CVE-2026-98642

Indicators of Compromise

  • KASAN reports showing slab-use-after-free in llist_del_first with the freeing stack ending in __free_rcu_tasks_trace and the allocating stack in alloc_bulk or bpf_mem_refill.
  • Unexpected kernel oops or general protection faults originating from kernel/bpf/memalloc.c on hosts running BPF-heavy workloads.
  • Processes without legitimate BPF usage repeatedly invoking bpf() syscalls that trigger map element allocation.

Detection Strategies

  • Audit bpf() syscall activity and correlate frequent map create/update operations from unprivileged users with kernel crash telemetry.
  • Enable KASAN on test and canary systems to surface the UAF before it reaches production.
  • Monitor loaded BPF programs with bpftool prog show and alert on unexpected program types or privileged attachments.

Monitoring Recommendations

  • Collect kernel ring buffer logs (dmesg, /dev/kmsg) into a centralized logging pipeline and alert on BUG:, KASAN:, or general protection fault strings referencing memalloc.c.
  • Track kernel version inventory across the fleet to confirm patch coverage for the referenced stable commits.
  • Baseline BPF syscall rates per user and workload, flagging deviations that may indicate race-condition exploitation attempts.

How to Mitigate CVE-2026-98642

Immediate Actions Required

  • Apply the stable kernel updates containing the fix commits 1c21452, 1d6581b, a0e150a, and f101602.
  • Reboot into the patched kernel; live-patch frameworks may not cover BPF memory allocator changes.
  • Inventory hosts allowing unprivileged BPF and prioritize them for patching.

Patch Information

The upstream fix introduces a raw spinlock that serializes consumers of waiting_for_gp_ttrace and free_by_rcu_ttrace against the RCU Tasks Trace reclaim path. Distribution maintainers have backported the change to supported stable trees. Confirm your running kernel includes the referenced commits using uname -r and your vendor's errata channel.

Workarounds

  • Set kernel.unprivileged_bpf_disabled=1 via sysctl to prevent non-root users from loading BPF programs and reduce the race's attack surface.
  • Restrict CAP_BPF and CAP_SYS_ADMIN to trusted service accounts only, using systemd unit CapabilityBoundingSet or SELinux policy.
  • Where feasible, disable JIT (net.core.bpf_jit_enable=0) and audit third-party agents that load BPF programs.
bash
# Configuration example
sysctl -w kernel.unprivileged_bpf_disabled=1
echo 'kernel.unprivileged_bpf_disabled=1' > /etc/sysctl.d/90-bpf-hardening.conf
sysctl --system

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.