aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/priv_prog.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2024-01-23 18:21:23 -0800
committerAlexei Starovoitov <ast@kernel.org>2024-01-24 16:21:03 -0800
commitd5baf0cac627fb3a00d9235955a388e5930b6d0e (patch)
tree4cd6e9ced35654a88e0658976f8cf7fd1a39d63e /tools/testing/selftests/bpf/progs/priv_prog.c
parent6b434b61b4d9e0e59f2947ce0f58f6fb4de048d8 (diff)
selftests/bpf: Add BPF object loading tests with explicit token passing
Add a few tests that attempt to load BPF object containing privileged map, program, and the one requiring mandatory BTF uploading into the kernel (to validate token FD propagation to BPF_BTF_LOAD command). Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20240124022127.2379740-27-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/progs/priv_prog.c')
-rw-r--r--tools/testing/selftests/bpf/progs/priv_prog.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/priv_prog.c b/tools/testing/selftests/bpf/progs/priv_prog.c
new file mode 100644
index 000000000000..3c7b2b618c8a
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/priv_prog.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
+
+#include "vmlinux.h"
+#include <bpf/bpf_helpers.h>
+
+char _license[] SEC("license") = "GPL";
+
+SEC("kprobe")
+int kprobe_prog(void *ctx)
+{
+ return 1;
+}