On Fri, 2025-01-31 at 11:28 -0800, Amery Hung wrote: > From: Amery Hung <amery.hung@xxxxxxxxxxxxx> > > Currently, add_kfunc_call() is only invoked once before the main > verification loop. Therefore, the verifier could not find the > bpf_kfunc_btf_tab of a new kfunc call which is not seen in user defined > struct_ops operators but introduced in gen_prologue or gen_epilogue > during do_misc_fixup(). Fix this by searching kfuncs in the patching > instruction buffer and add them to prog->aux->kfunc_tab. > > Signed-off-by: Amery Hung <amery.hung@xxxxxxxxxxxxx> > --- Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx> [...] > @@ -20397,6 +20412,10 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) > return -ENOMEM; > env->prog = new_prog; > delta += cnt - 1; > + > + ret = add_kfunc_in_insns(env, epilogue_buf, epilogue_cnt - 1); Rant: the -1 here is a bit confusing, it is second time I forget that last instruction of the epilogue has to be some kind of control flow, and last instruction of the prologue has to be first instruction of the program. > + if (ret < 0) > + return ret; > } > } > [...]