CVE-2026-139606: bpf: Leave out the hidden exit edge of a subprogram without an exit
In the Linux kernel, the following vulnerability has been resolved:
bpf: Leave out the hidden exit edge of a subprogram without an exit
visitabnormalreturninsn() gives tailcall and ld{abs,ind} insns a second successor, the exitidx of their subprogram, so that the hidden exit from the subprogram is part of the CFG. checksubprogs() only assigns exitidx when it walks over a BPFEXIT, and a subprogram whose last insn jumps back into itself never has one, so exitidx stays zero and the edge points at insn 0 of the program:
0: r0 = 0 1: r0 = (u8 )skb[0] 2: goto -2
For a subprogram other than main, updateinsn() then reads the liveness masks at a negative relative index. Such a subprogram can still load when it leaves through a bpfthrow(), so mark exitidx as unset in that case and leave the hidden edge out, as there is no exit for it to reach.
Affected Software
Event History
Frequently Asked Questions
What BPF program structure is affected?
The issue involves a non-main BPF subprogram that has no BPF_EXIT instruction because its final instruction jumps back into the subprogram. The problematic control-flow handling applies when hidden exit edges are considered for tail_call or ld_abs/ld_ind instructions.
What is required for the problematic subprogram to load?
The description states that such a subprogram can still load when it leaves through bpf_throw(). This requires a non-main subprogram with no reachable normal exit, rather than an ordinary subprogram containing a BPF_EXIT.
How can I identify potentially affected BPF code?
Review BPF programs for non-main subprograms whose last instruction loops back into the subprogram and that contain no BPF_EXIT. Pay particular attention if those subprograms use bpf_throw() as their way to leave and include tail_call or ld_abs/ld_ind control-flow paths.