From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
<martin.lau@kernel.org>
Cc: <cyphar@cyphar.com>, <brauner@kernel.org>,
<lennart@poettering.net>, <linux-fsdevel@vger.kernel.org>,
Andrii Nakryiko <andrii@kernel.org>
Subject: [PATCH v2 bpf-next 0/3] Add O_PATH-based BPF_OBJ_PIN and BPF_OBJ_GET support
Date: Thu, 18 May 2023 14:54:41 -0700 [thread overview]
Message-ID: <20230518215444.1418789-1-andrii@kernel.org> (raw)
Add ability to specify pinning location within BPF FS using O_PATH-based FDs,
similar to openat() family of APIs. Patch #1 adds necessary kernel-side
changes. Patch #2 exposes this through libbpf APIs. Patch #3 uses new mount
APIs (fsopen, fsconfig, fsmount) to demonstrated how now it's possible to work
with detach-mounted BPF FS using new BPF_OBJ_PIN and BPF_OBJ_GET
functionality.
This feature is inspired as a result of recent conversations during
LSF/MM/BPF 2023 conference about shortcomings of being able to perform BPF
objects pinning only using lookup-based paths.
v1->v2:
- add BPF_F_PATH_FD flag that should go along with path FD (Christian).
Andrii Nakryiko (3):
bpf: support O_PATH FDs in BPF_OBJ_PIN and BPF_OBJ_GET commands
libbpf: add opts-based bpf_obj_pin() API and add support for path_fd
selftests/bpf: add path_fd-based BPF_OBJ_PIN and BPF_OBJ_GET tests
include/linux/bpf.h | 4 +-
include/uapi/linux/bpf.h | 10 ++
kernel/bpf/inode.c | 16 +--
kernel/bpf/syscall.c | 25 +++-
tools/include/uapi/linux/bpf.h | 10 ++
tools/lib/bpf/bpf.c | 17 ++-
tools/lib/bpf/bpf.h | 18 ++-
tools/lib/bpf/libbpf.map | 1 +
.../bpf/prog_tests/bpf_obj_pinning.c | 112 ++++++++++++++++++
9 files changed, 193 insertions(+), 20 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning.c
--
2.34.1
next reply other threads:[~2023-05-18 21:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 21:54 Andrii Nakryiko [this message]
2023-05-18 21:54 ` [PATCH v2 bpf-next 1/3] bpf: support O_PATH FDs in BPF_OBJ_PIN and BPF_OBJ_GET commands Andrii Nakryiko
2023-05-18 23:58 ` kernel test robot
2023-05-19 0:19 ` Andrii Nakryiko
2023-05-19 0:53 ` Alexei Starovoitov
2023-05-19 2:42 ` Andrii Nakryiko
2023-05-19 9:49 ` Christian Brauner
2023-05-19 12:37 ` Christian Brauner
2023-05-19 16:01 ` Andrii Nakryiko
2023-05-20 13:39 ` Christian Brauner
2023-05-18 21:54 ` [PATCH v2 bpf-next 2/3] libbpf: add opts-based bpf_obj_pin() API and add support for path_fd Andrii Nakryiko
2023-05-18 21:54 ` [PATCH v2 bpf-next 3/3] selftests/bpf: add path_fd-based BPF_OBJ_PIN and BPF_OBJ_GET tests Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230518215444.1418789-1-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=cyphar@cyphar.com \
--cc=daniel@iogearbox.net \
--cc=lennart@poettering.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=martin.lau@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).