]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: make bpf_insn_successors to return a pointer
authorAnton Protopopov <a.s.protopopov@gmail.com>
Sun, 19 Oct 2025 20:21:37 +0000 (20:21 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 21 Oct 2025 18:20:23 +0000 (11:20 -0700)
commit2f69c5685427308d2f312646779313f3677536bc
treecaf0b94684fed954f24db8e6773324eae8fbef82
parent44481e4925327d833f2e37c8741406e4cabfe054
bpf: make bpf_insn_successors to return a pointer

The bpf_insn_successors() function is used to return successors
to a BPF instruction. So far, an instruction could have 0, 1 or 2
successors. Prepare the verifier code to introduction of instructions
with more than 2 successors (namely, indirect jumps).

To do this, introduce a new struct, struct bpf_iarray, containing
an array of bpf instruction indexes and make bpf_insn_successors
to return a pointer of that type. The storage for all instructions
is allocated in the env->succ, which holds an array of size 2,
to be used for all instructions.

Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20251019202145.3944697-10-a.s.protopopov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf_verifier.h
kernel/bpf/liveness.c
kernel/bpf/verifier.c