diff options
author | Alexei Starovoitov <ast@kernel.org> | 2024-03-07 06:12:24 +0300 |
---|---|---|
committer | Martin KaFai Lau <martin.lau@kernel.org> | 2024-03-08 01:58:48 +0300 |
commit | 8d94f1357c00d7706c1f3d0bb568e054cef6aea1 (patch) | |
tree | 862e04056270e16af686d28debe629be4daeba1b /kernel/bpf/stackmap.c | |
parent | 88d1d4a7eebea2836859246d91fe9d141789dfc3 (diff) | |
download | linux-8d94f1357c00d7706c1f3d0bb568e054cef6aea1.tar.xz |
bpf: Recognize '__map' suffix in kfunc arguments
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 as well, but bpf prog would need to type cast the argument
(void *)&arena, which is not clean.
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/r/20240307031228.42896-3-alexei.starovoitov@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'kernel/bpf/stackmap.c')
0 files changed, 0 insertions, 0 deletions