]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: Add helper to detect indirect jump targets
authorXu Kuohai <xukuohai@huawei.com>
Thu, 16 Apr 2026 06:43:39 +0000 (06:43 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 16 Apr 2026 14:03:40 +0000 (07:03 -0700)
commit07ae6c130b46cf5e3e1a7dc5c1889fefe9adc2d3
tree04f7eb3396760c084bdd14ac763f63149100f47c
parentd9ef13f72711f2dad64cd4445472ded98fb6c954
bpf: Add helper to detect indirect jump targets

Introduce helper bpf_insn_is_indirect_target to check whether a BPF
instruction is an indirect jump target.

Since the verifier knows which instructions are indirect jump targets,
add a new flag indirect_target to struct bpf_insn_aux_data to mark
them. The verifier sets this flag when verifying an indirect jump target
instruction, and the helper checks the flag to determine whether an
instruction is an indirect jump target.

Reviewed-by: Anton Protopopov <a.s.protopopov@gmail.com> #v8
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> #v12
Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Link: https://lore.kernel.org/r/20260416064341.151802-4-xukuohai@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
include/linux/bpf_verifier.h
kernel/bpf/core.c
kernel/bpf/fixups.c
kernel/bpf/verifier.c