summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs
diff options
context:
space:
mode:
authorMykyta Yatsenko <yatsenko@meta.com>2025-04-09 02:44:17 +0300
committerAndrii Nakryiko <andrii@kernel.org>2025-04-10 02:16:56 +0300
commitb8390dd1e09e1abf73299209e9e7bcc2585b88e6 (patch)
tree0fef4346219cd350de9cc77af900fd97fcfc6cc4 /tools/testing/selftests/bpf/progs
parent243d720e2e5320f7ed09034361aa20b74d8eeb03 (diff)
downloadlinux-b8390dd1e09e1abf73299209e9e7bcc2585b88e6.tar.xz
selftests/bpf: Add BTF.ext line/func info getter tests
Add selftests checking that line and func info retrieved by newly added libbpf APIs are the same as returned by kernel via bpf_prog_get_info_by_fd. Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20250408234417.452565-3-mykyta.yatsenko5@gmail.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs')
-rw-r--r--tools/testing/selftests/bpf/progs/test_btf_ext.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_btf_ext.c b/tools/testing/selftests/bpf/progs/test_btf_ext.c
new file mode 100644
index 000000000000..cdf20331db04
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/test_btf_ext.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (c) 2025 Meta Platforms Inc. */
+
+#include <linux/bpf.h>
+#include <bpf/bpf_helpers.h>
+#include "bpf_misc.h"
+
+char _license[] SEC("license") = "GPL";
+
+__noinline static void f0(void)
+{
+ __u64 a = 1;
+
+ __sink(a);
+}
+
+SEC("xdp")
+__u64 global_func(struct xdp_md *xdp)
+{
+ f0();
+ return XDP_DROP;
+}