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

CVE-2026-98787: Linux Kernel Race Condition Vulnerability

CVE-2026-98787 is a race condition flaw in the Linux kernel affecting BPF hash table operations. Missing migration protection can cause CPU migration during delete operations. 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-98787 Overview

CVE-2026-98787 affects the Linux kernel's Berkeley Packet Filter (BPF) subsystem. The flaw resides in __rhtab_map_lookup_and_delete_batch(), which calls rhtab_delete_elem() under rcu_read_lock() without disabling migration. On kernels built with CONFIG_PREEMPT_RCU, rcu_read_lock() does not disable preemption or migration, allowing the task to migrate between CPUs during the delete loop. The subsequent this_cpu_ptr() call inside bpf_mem_cache_free_rcu() then triggers a BUG: using smp_processor_id() in preemptible warning. The issue was addressed by wrapping the delete loop in migrate_disable()/migrate_enable().

Critical Impact

Local tasks invoking BPF hash map batch lookup-and-delete operations on CONFIG_PREEMPT_RCU kernels can trigger kernel warnings and potential instability through unsafe per-CPU access.

Affected Products

  • Linux kernel BPF subsystem (kernel/bpf)
  • Kernels compiled with CONFIG_PREEMPT_RCU
  • Distributions shipping affected upstream kernel versions prior to the fix commits

Discovery Timeline

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

Technical Details for CVE-2026-98787

Vulnerability Analysis

The vulnerability is a kernel race condition caused by missing migration protection in BPF hash map batch operations. The function __rhtab_map_lookup_and_delete_batch() iterates over hash map entries and invokes rhtab_delete_elem() to free them. All other callers of rhtab_delete_elem() already disable migration before the call. The batch path relied solely on rcu_read_lock(), which is insufficient on preemptible RCU kernels.

Deep inside the delete path, bpf_mem_cache_free_rcu() calls this_cpu_ptr() to access per-CPU allocator state. this_cpu_ptr() requires that the task cannot migrate between CPUs during the access. If the scheduler migrates the task mid-loop, the per-CPU pointer becomes stale and the kernel emits a BUG: using smp_processor_id() in preemptible [00000000] code warning. This can corrupt the BPF memory allocator's per-CPU state and destabilize the system.

Root Cause

The root cause is an incorrect assumption that rcu_read_lock() provides migration protection. Under CONFIG_PREEMPT_RCU, rcu_read_lock() only marks an RCU read-side critical section and does not disable preemption or CPU migration. The batch delete loop therefore executed this_cpu_ptr() in a context where migration remained possible [CWE-367 TOCTOU-style per-CPU access].

Attack Vector

Exploitation requires local access with the ability to invoke the BPF_MAP_LOOKUP_AND_DELETE_BATCH command on a resizable hash table map (BPF_MAP_TYPE_HASH or similar). A local user or workload with BPF privileges can trigger repeated batch delete operations to race scheduler migration, producing kernel warnings and potential allocator state corruption. The vulnerability is not remotely reachable and does not provide direct code execution.

See the upstream fix commits 94f41ec5fa578765b74ad5736c2f029e7aabc46d and de020dc8049bfb2b22e3b6d99c031feb2e22d112 for the corrective patch wrapping the delete loop in migrate_disable()/migrate_enable().

Detection Methods for CVE-2026-98787

Indicators of Compromise

  • Kernel log entries containing BUG: using smp_processor_id() in preemptible referencing bpf_mem_cache_free_rcu or rhtab_delete_elem in the call stack.
  • Unexpected WARN_ON splats originating from kernel/bpf/hashtab.c during batch map operations.
  • Processes with CAP_BPF or CAP_SYS_ADMIN repeatedly invoking BPF_MAP_LOOKUP_AND_DELETE_BATCH syscalls.

Detection Strategies

  • Collect dmesg and /var/log/kern.log output and alert on smp_processor_id() in preemptible patterns correlated with BPF symbols.
  • Audit bpf() syscall telemetry via auditd or eBPF-based observability to flag high-frequency batch lookup-and-delete calls.
  • Inventory kernel builds and flag hosts running CONFIG_PREEMPT_RCU kernels at versions below the patched commits.

Monitoring Recommendations

  • Forward kernel logs to a centralized SIEM and build detections for RCU and per-CPU BUG/WARN messages.
  • Baseline normal BPF syscall rates per workload and alert on anomalous spikes from non-privileged service accounts.
  • Track kernel package versions across the fleet and gate production deployments on patched builds.

How to Mitigate CVE-2026-98787

Immediate Actions Required

  • Identify hosts running CONFIG_PREEMPT_RCU kernels and prioritize them for patching.
  • Restrict CAP_BPF and CAP_SYS_ADMIN to trusted workloads to limit who can invoke batch BPF operations.
  • Monitor kernel logs for the signature BUG: using smp_processor_id() in preemptible and investigate affected nodes.

Patch Information

The fix wraps the batch delete loop in __rhtab_map_lookup_and_delete_batch() with migrate_disable() and migrate_enable(), matching the migration protection the other callers of rhtab_delete_elem() already provide. Apply the upstream commits 94f41ec5fa578765b74ad5736c2f029e7aabc46d and de020dc8049bfb2b22e3b6d99c031feb2e22d112, or update to a stable kernel release that includes them from your distribution vendor.

Workarounds

  • Where feasible, boot a kernel configured without CONFIG_PREEMPT_RCU until the patched kernel can be deployed.
  • Reduce exposure by denying unprivileged BPF via kernel.unprivileged_bpf_disabled=1 and tightening seccomp/AppArmor profiles for workloads that do not require BPF.
  • Avoid user-space tooling that performs large BPF_MAP_LOOKUP_AND_DELETE_BATCH operations on affected kernels.

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.