bpf: Allow attach TRACING programs through LINK_CREATE command
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 21 Apr 2022 03:39:43 +0000 (20:39 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 22 Apr 2022 22:36:55 +0000 (00:36 +0200)
commitdf86ca0d2f0fa6be525a25b0b3d836d361f85754
treedc0f58c0107ce9f7513592eacf1757185de5b980
parente8c5e1a0f78fbfc4396866959fef43b258318b6f
bpf: Allow attach TRACING programs through LINK_CREATE command

Allow attaching BTF-aware TRACING programs, previously attachable only
through BPF_RAW_TRACEPOINT_OPEN command, through LINK_CREATE command:

  - BTF-aware raw tracepoints (tp_btf in libbpf lingo);
  - fentry/fexit/fmod_ret programs;
  - BPF LSM programs.

This change converges all bpf_link-based attachments under LINK_CREATE
command allowing to further extend the API with features like BPF cookie
under "multiplexed" link_create section of bpf_attr.

Non-BTF-aware raw tracepoints are left under BPF_RAW_TRACEPOINT_OPEN,
but there is nothing preventing opening them up to LINK_CREATE as well.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Kuifeng Lee <kuifeng@fb.com>
Link: https://lore.kernel.org/bpf/20220421033945.3602803-2-andrii@kernel.org
kernel/bpf/syscall.c