Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: Allow kfunc in tracing and syscall programs.

Tracing and syscall BPF program types are very convenient to add BPF
capabilities to subsystem otherwise not BPF capable.
When we add kfuncs capabilities to those program types, we can add
BPF features to subsystems without having to touch BPF core.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20220518205924.399291-2-benjamin.tissoires@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Benjamin Tissoires and committed by
Alexei Starovoitov
97949767 2dc323b1

+6
+6
kernel/bpf/btf.c
··· 202 202 BTF_KFUNC_HOOK_XDP, 203 203 BTF_KFUNC_HOOK_TC, 204 204 BTF_KFUNC_HOOK_STRUCT_OPS, 205 + BTF_KFUNC_HOOK_TRACING, 206 + BTF_KFUNC_HOOK_SYSCALL, 205 207 BTF_KFUNC_HOOK_MAX, 206 208 }; 207 209 ··· 7112 7110 return BTF_KFUNC_HOOK_TC; 7113 7111 case BPF_PROG_TYPE_STRUCT_OPS: 7114 7112 return BTF_KFUNC_HOOK_STRUCT_OPS; 7113 + case BPF_PROG_TYPE_TRACING: 7114 + return BTF_KFUNC_HOOK_TRACING; 7115 + case BPF_PROG_TYPE_SYSCALL: 7116 + return BTF_KFUNC_HOOK_SYSCALL; 7115 7117 default: 7116 7118 return BTF_KFUNC_HOOK_MAX; 7117 7119 }