aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/priv_prog.c
diff options
context:
space:
mode:
authorMykyta Yatsenko <[email protected]>2025-03-17 17:40:39 +0000
committerAndrii Nakryiko <[email protected]>2025-03-17 20:45:12 +0000
commita024843d92cca491034dac648bcfec967199a4a4 (patch)
tree62436d27fd49365a4db2b9fa92065b6aabbca28c /tools/testing/selftests/bpf/progs/priv_prog.c
parentlibbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID (diff)
downloadkernel-a024843d92cca491034dac648bcfec967199a4a4.tar.gz
kernel-a024843d92cca491034dac648bcfec967199a4a4.zip
selftests/bpf: Test freplace from user namespace
Add selftests to verify that it is possible to load freplace program from user namespace if BPF token is initialized by bpf_object__prepare before calling bpf_program__set_attach_target. Negative test is added as well. Modified type of the priv_prog to xdp, as kprobe did not work on aarch64 and s390x. Signed-off-by: Mykyta Yatsenko <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/progs/priv_prog.c')
-rw-r--r--tools/testing/selftests/bpf/progs/priv_prog.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/progs/priv_prog.c b/tools/testing/selftests/bpf/progs/priv_prog.c
index 3c7b2b618c8a..725e29595079 100644
--- a/tools/testing/selftests/bpf/progs/priv_prog.c
+++ b/tools/testing/selftests/bpf/progs/priv_prog.c
@@ -6,8 +6,8 @@
char _license[] SEC("license") = "GPL";
-SEC("kprobe")
-int kprobe_prog(void *ctx)
+SEC("xdp")
+int xdp_prog1(struct xdp_md *xdp)
{
- return 1;
+ return XDP_DROP;
}