]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf: Don't call fsopen() as privileged user
authorMatteo Croce <teknoraver@meta.com>
Tue, 1 Jul 2025 18:31:23 +0000 (20:31 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 2 Jul 2025 17:42:54 +0000 (10:42 -0700)
commit07ee18a0bc946b6b407942c88faed089e20f47d1
tree30ce5d5dcf9116200ac3cc5b4d148b3747d7e30f
parent1230be820981a3ef0fb9abc011f1b3d093f3b1e4
selftests/bpf: Don't call fsopen() as privileged user

In the BPF token example, the fsopen() syscall is called as privileged
user. This is unneeded because fsopen() can be called also as
unprivileged user from the user namespace.
As the `fs_fd` file descriptor which was sent back and forth is still the
same, keep it open instead of cloning and closing it twice via SCM_RIGHTS.

cfr. https://github.com/systemd/systemd/pull/36134

Signed-off-by: Matteo Croce <teknoraver@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/bpf/20250701183123.31781-1-technoboy85@gmail.com
tools/testing/selftests/bpf/prog_tests/token.c