]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: Check global subprog exception paths
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sun, 17 May 2026 07:55:28 +0000 (09:55 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 17 May 2026 18:15:05 +0000 (11:15 -0700)
commit3d562d35a044ae798cab421c65a116f8cedfa5d4
tree7ca6183545d46e4a159bf95b822b11511ed810b6
parenta828abbb897657451d96ad7bf20f1893ac983bb9
bpf: Check global subprog exception paths

Global subprogs are verified independently and are not descended into
when their callers are symbolically executed. This means a caller can
hold references or locks across a global subprog call that may throw,
while the verifier only checks the non-exceptional return path at the
call site.

Record whether a subprog might throw in the CFG summary pass, alongside
the existing might_sleep and packet-data-changing summaries, and
propagate that effect through reachable callees.

When a global subprog is marked as possibly throwing, push the normal
continuation and validate the exceptional path immediately at the call
site, avoiding a synthetic exception state and associated special case
in the pruning checks.

Fixes: f18b03fabaa9 ("bpf: Implement BPF exceptions")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20260517075530.3461166-2-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf_verifier.h
kernel/bpf/cfg.c
kernel/bpf/verifier.c