linux-stable/include/uapi
Andrii Nakryiko cb8edce280 bpf: Support O_PATH FDs in BPF_OBJ_PIN and BPF_OBJ_GET commands
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>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/bpf/20230523170013.728457-4-andrii@kernel.org
2023-05-23 23:31:42 +02:00
..
asm-generic open: return EINVAL for O_DIRECTORY | O_CREAT 2023-03-22 11:06:55 +01:00
drm Merge tag 'drm-msm-next-2023-04-10' of https://gitlab.freedesktop.org/drm/msm into drm-next 2023-04-11 12:21:50 +02:00
linux bpf: Support O_PATH FDs in BPF_OBJ_PIN and BPF_OBJ_GET commands 2023-05-23 23:31:42 +02:00
misc habanalabs/uapi: move uapi file to drm 2023-01-26 10:56:23 +02:00
mtd
rdma RDMA/efa: Add rdma write capability to device caps 2023-04-21 19:18:58 -03:00
scsi scsi: mpi3mr: Replace 1-element array with flex-array 2023-02-21 22:00:50 -05:00
sound sound updates for 6.4-rc1 2023-04-27 10:58:37 -07:00
video
xen
Kbuild