KernelScan.io

HIGH Introduced in 7.2

bpf RhtabElem UAF

CVE-2026-98035

CVSS 8.7 / 10.0 KernelScan AI

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

01

In the Linux kernel, the following vulnerability has been resolved: bpf: Cancel special fields when recycling rhtab elements rhtab_map_update_existing() and rhtab_delete_elem() call bpf_obj_free_fields() when replacing or deleting a value. These map operations can run from BPF programs in NMI context, where releasing a referenced kptr or another complex field is not generally safe. Array and hash maps avoid that problem by cancelling only the asynchronous fields which can be stopped safely in the caller context. Other ownership state remains attached to the allocation until its memory allocator destructor performs the final cleanup. Use bpf_obj_cancel_fields() for the corresponding rhtab paths as well. This cancels timers, workqueues, and task work while allowing rhtab_mem_dtor() to release referenced kptrs when the allocation is eventually destroyed. [ kkd: Rebased, used direct helper calls, and rewrote the commit log ]

02

Engine v0.6.0

Risk summary

A BPF resizable hashtable map incorrectly releases referenced kptrs and other complex fields during element update or delete operations that can execute in NMI context, where such cleanup is unsafe. This can lead to kernel memory corruption or panics. The vulnerability is reachable by any user who can load BPF programs (CAP_BPF), which is obtainable in a user namespace, making it exploitable from unprivileged containers.

Affectedkernel/bpf/hashtab.c (bpf resizable hashtable)

Vulnerability analysis

When a BPF program updates or deletes an element in a resizable hashtable map that contains special fields such as referenced kptrs, timers, or workqueues, the cleanup path immediately frees all of those fields. These map operations can execute from BPF programs running in NMI context, where releasing referenced kernel pointers and other complex fields is not safe and can corrupt kernel memory or crash the system. The fix replaces the full field-release call with one that only cancels asynchronous fields (timers, workqueues, task work) that can be safely stopped in the caller's context, while deferring the release of referenced kptrs to the memory allocator's destructor when the element's allocation is eventually destroyed. This vulnerability is reachable by any user who can load BPF programs, which requires CAP_BPF — a capability obtainable inside a user namespace on most configurations, making it exploitable from unprivileged containers.

03

BranchIntroducedFixed inPatch commit
7.27.27.2.728fde1356dbc
mainline7.27.3-rc265cc95eba9e8