-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add O_PATH-based BPF_OBJ_PIN and BPF_OBJ_GET support #5076
Conversation
Upstream branch: 108598c |
e35e124
to
4d9941c
Compare
Upstream branch: 108598c |
4661cc1
to
55671e3
Compare
4d9941c
to
73bb5bc
Compare
Upstream branch: 108598c |
55671e3
to
244702c
Compare
73bb5bc
to
5ef086f
Compare
Upstream branch: 3879122 |
244702c
to
d1eb2a7
Compare
5ef086f
to
380f2de
Compare
Upstream branch: de58ef4 |
d1eb2a7
to
857ca4f
Compare
380f2de
to
ecc5371
Compare
Upstream branch: 0697e43 |
857ca4f
to
3e3ebd0
Compare
ecc5371
to
95cf174
Compare
Upstream branch: cff3639 |
3e3ebd0
to
8e50d5e
Compare
95cf174
to
bf42de8
Compare
Upstream branch: 2a36c26 |
8e50d5e
to
0794742
Compare
bf42de8
to
528fccf
Compare
Upstream branch: 8819495 |
0794742
to
880e104
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=747804 expired. Closing PR. |
Current UAPI of BPF_OBJ_PIN and BPF_OBJ_GET commands of bpf() syscall forces users to specify pinning location as a string-based absolute or relative (to current working directory) path. This has various implications related to security (e.g., symlink-based attacks), forces BPF FS to be exposed in the file system, which can cause races with other applications. One of the feedbacks we got from folks working with containers heavily was that inability to use purely FD-based location specification was an unfortunate limitation and hindrance for BPF_OBJ_PIN and BPF_OBJ_GET commands. This patch closes this oversight, adding path_fd field to BPF_OBJ_PIN and BPF_OBJ_GET UAPI, following conventions established by *at() syscalls for dirfd + pathname combinations. This now allows interesting possibilities like working with detached BPF FS mount (e.g., to perform multiple pinnings without running a risk of someone interfering with them), and generally making pinning/getting more secure and not prone to any races and/or security attacks. This is demonstrated by a selftest added in subsequent patch that takes advantage of new mount APIs (fsopen, fsconfig, fsmount) to demonstrate creating detached BPF FS mount, pinning, and then getting BPF map out of it, all while never exposing this private instance of BPF FS to outside worlds. Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Add path_fd support for bpf_obj_pin() and bpf_obj_get() operations (through their opts-based variants). This allows to take advantage of new kernel-side support for O_PATH-based pin/get location specification. Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Add a selftest demonstrating using detach-mounted BPF FS using new mount APIs, and pinning and getting BPF map using such mount. This demonstrates how something like container manager could setup BPF FS, pin and adjust all the necessary objects in it, all before exposing BPF FS to a particular mount namespace. Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Upstream branch: effcf62 |
880e104
to
7ddad94
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=749044 expired. Closing PR. |
Pull request for series with
subject: Add O_PATH-based BPF_OBJ_PIN and BPF_OBJ_GET support
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=747804