bpf: extract iterator argument type and name validation logic
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 8 Aug 2024 23:22:28 +0000 (16:22 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 21 Aug 2024 17:37:52 +0000 (10:37 -0700)
commit496ddd19a0fad22f250fc7a7b7a8000155418934
tree17a266c5749d9adbb3015ae4640bfa15a9975ce0
parent01ac89d0a5c2332be25a1b7ef707bad9ddb9fc20
bpf: extract iterator argument type and name validation logic

Verifier enforces that all iterator structs are named `bpf_iter_<name>`
and that whenever iterator is passed to a kfunc it's passed as a valid PTR ->
STRUCT chain (with potentially const modifiers in between).

We'll need this check for upcoming changes, so instead of duplicating
the logic, extract it into a helper function.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20240808232230.2848712-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/btf.h
kernel/bpf/btf.c