Skip to contentSkip to conversation

CVE-2026-98084: bpf: backtracking shouldn't clear outer frame R1-R5 for callbacks

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Sep 25

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

bpf: backtracking shouldn't clear outer frame R1-R5 for callbacks

When processing calls to bpf_loop() verifier marks R1 (and R4) as precise. R1 tracks loop iterations number and because of the 'callback_depth < R1' mechanics in check_helper_call() must be marked precise. However, precision propagation for R1 was broken, when bpf_loop() call was verified on a second iteration.

Consider the following verification trace:
- main: bpf_loop(nr_loops, callback ...)
- callback: BPF_EXIT
- main: bpf_loop(nr_loops, callback ...)
- ...

While the first visit of the call to bpf_loop() propagated R1 precision as expected, the second call to mark_chain_precision() in the check_helper_call() set R1, but it was immediately reset when backtrack_insn() processed preceding BPF_EXIT in the loop deleted in this patch.

Because of that, the second visit of the call to bpf_loop() injected checkpoint with R1 not marked as precise. Which could trick the verifier into accepting unsafe programs. See the next patch for an example of such program.

Commit is structured in a way to minimize conflicts when 'bpf' would be eventually merged with 'bpf-next'.

The Linux kernel CVE team has assigned CVE-2026-98084 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.7 with commit ab5cfac139ab8576fb54630d4cca23c3e690ee90 and fixed in 7.2.7 with commit f83890dfed9efc5e19df1dbc1ad707a142936923
	Issue introduced in 6.7 with commit ab5cfac139ab8576fb54630d4cca23c3e690ee90 and fixed in 7.3-rc2 with commit e3e4f66cc4b72333d0886ae2673c360248987889
	Issue introduced in 6.6.15 with commit b43550d7d58e7ae6618aaab18c1e912fa4d6e3dd

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-98084

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
kernel/bpf/backtrack.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/f83890dfed9efc5e19df1dbc1ad707a142936923
	https://git.kernel.org/stable/c/e3e4f66cc4b72333d0886ae2673c360248987889