On Fri, 9 Feb 2024 at 05:06, Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > From: Alexei Starovoitov <ast@xxxxxxxxxx> > > Recognize 'void *p__map' kfunc argument as 'struct bpf_map *p__map'. > It allows kfunc to have 'void *' argument for maps, since bpf progs > will call them as: > struct { > __uint(type, BPF_MAP_TYPE_ARENA); > ... > } arena SEC(".maps"); > > bpf_kfunc_with_map(... &arena ...); > > Underneath libbpf will load CONST_PTR_TO_MAP into the register via ld_imm64 insn. > If kfunc was defined with 'struct bpf_map *' it would pass > the verifier, but bpf prog would need to use '(void *)&arena'. > Which is not clean. > > Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> > --- Acked-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> > [...]