From: Amery Hung Date: Wed, 3 Dec 2025 23:37:43 +0000 (-0800) Subject: bpf: Allow verifier to fixup kernel module kfuncs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1588c81b9f215170bd596984691eda2f05a84a1f;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Andrii Nakryiko Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20251203233748.668365-2-ameryhung@gmail.com --- diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index f0ca69f888fac..bb7eca1025c35 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -22493,8 +22493,7 @@ static int fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn, if (!bpf_jit_supports_far_kfunc_call()) insn->imm = BPF_CALL_IMM(desc->addr); - if (insn->off) - return 0; + if (desc->func_id == special_kfunc_list[KF_bpf_obj_new_impl] || desc->func_id == special_kfunc_list[KF_bpf_percpu_obj_new_impl]) { struct btf_struct_meta *kptr_struct_meta = env->insn_aux_data[insn_idx].kptr_struct_meta;