Skip to content

Commit 1588c81

Browse files
ameryhunganakryiko
authored andcommitted
bpf: Allow verifier to fixup kernel module kfuncs
Allow verifier to fixup kfuncs in kernel module to support kfuncs with __prog arguments. Currently, special kfuncs and kfuncs with __prog arguments are kernel kfuncs. Allowing kernel module kfuncs should not affect existing kfunc fixup as kernel module kfuncs have BTF IDs greater than kernel kfuncs' BTF IDs. Signed-off-by: Amery Hung <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 81f88f6 commit 1588c81

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/bpf/verifier.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22493,8 +22493,7 @@ static int fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn,
2249322493

2249422494
if (!bpf_jit_supports_far_kfunc_call())
2249522495
insn->imm = BPF_CALL_IMM(desc->addr);
22496-
if (insn->off)
22497-
return 0;
22496+
2249822497
if (desc->func_id == special_kfunc_list[KF_bpf_obj_new_impl] ||
2249922498
desc->func_id == special_kfunc_list[KF_bpf_percpu_obj_new_impl]) {
2250022499
struct btf_struct_meta *kptr_struct_meta = env->insn_aux_data[insn_idx].kptr_struct_meta;

0 commit comments

Comments
 (0)