bpf: Add kfunc filter function to 'struct btf_kfunc_id_set'
authorAditi Ghag <aditi.ghag@isovalent.com>
Fri, 19 May 2023 22:51:54 +0000 (22:51 +0000)
committerMartin KaFai Lau <martin.lau@kernel.org>
Sat, 20 May 2023 05:44:14 +0000 (22:44 -0700)
commite924e80ee6a39bc28d2ef8f51e19d336a98e3be0
tree9caa4a087cd59b60fbecbc2d727051bd0ffeb33d
parentc96dac8d369ffd713a45f4e5c30f23c47a1671f0
bpf: Add kfunc filter function to 'struct btf_kfunc_id_set'

This commit adds the ability to filter kfuncs to certain BPF program
types. This is required to limit bpf_sock_destroy kfunc implemented in
follow-up commits to programs with attach type 'BPF_TRACE_ITER'.

The commit adds a callback filter to 'struct btf_kfunc_id_set'.  The
filter has access to the `bpf_prog` construct including its properties
such as `expected_attached_type`.

Signed-off-by: Aditi Ghag <aditi.ghag@isovalent.com>
Link: https://lore.kernel.org/r/20230519225157.760788-7-aditi.ghag@isovalent.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
include/linux/btf.h
kernel/bpf/btf.c
kernel/bpf/verifier.c