tools/libbpf: Add support for BPF_PROG_TYPE_LSM
authorKP Singh <kpsingh@google.com>
Sun, 29 Mar 2020 00:43:54 +0000 (01:43 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Sun, 29 Mar 2020 23:35:11 +0000 (01:35 +0200)
commit1e092a0318292637cde832868016f37e942eed24
treea1ba54bb8ab6571011f6f834e2516dee145c2221
parent520b7aa00d8cd8e411ecc09f63a2acd90feb6d29
tools/libbpf: Add support for BPF_PROG_TYPE_LSM

Since BPF_PROG_TYPE_LSM uses the same attaching mechanism as
BPF_PROG_TYPE_TRACING, the common logic is refactored into a static
function bpf_program__attach_btf_id.

A new API call bpf_program__attach_lsm is still added to avoid userspace
conflicts if this ever changes in the future.

Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Brendan Jackman <jackmanb@google.com>
Reviewed-by: Florent Revest <revest@google.com>
Reviewed-by: James Morris <jamorris@linux.microsoft.com>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200329004356.27286-7-kpsingh@chromium.org
tools/lib/bpf/bpf.c
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h
tools/lib/bpf/libbpf.map