On Thu, Feb 16, 2023 at 12:59:31AM +0100, Ilya Leoshkevich wrote: SNIP > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index 71158a6786a1..47d390923610 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -2115,8 +2115,8 @@ static int add_subprog(struct bpf_verifier_env *env, int off) > struct bpf_kfunc_desc { > struct btf_func_model func_model; > u32 func_id; > - s32 imm; > u16 offset; > + unsigned long addr; > }; > > struct bpf_kfunc_btf { > @@ -2166,6 +2166,19 @@ find_kfunc_desc(const struct bpf_prog *prog, u32 func_id, u16 offset) > sizeof(tab->descs[0]), kfunc_desc_cmp_by_id_off); > } > > +int bpf_get_kfunc_addr(const struct bpf_prog *prog, u32 func_id, u16 offset, > + u8 **func_addr) > +{ > + const struct bpf_kfunc_desc *desc; > + > + desc = find_kfunc_desc(prog, func_id, offset); > + if (!desc) > + return -EFAULT; should we warn here? this should alwayss succeed, right? jirka > + > + *func_addr = (u8 *)desc->addr; > + return 0; > +} > + SNIP