From: Song Liu <song@kernel.org>
To: bpf@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Cc: kernel-team@meta.com, andrii@kernel.org, eddyz87@gmail.com,
ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
kpsingh@kernel.org, mattbobrowski@google.com, amir73il@gmail.com,
gregkh@linuxfoundation.org, tj@kernel.org,
daan.j.demeyer@gmail.com, Song Liu <song@kernel.org>
Subject: [PATCH v3 bpf-next 0/4] Introduce bpf_cgroup_read_xattr
Date: Sun, 22 Jun 2025 23:38:50 -0700 [thread overview]
Message-ID: <20250623063854.1896364-1-song@kernel.org> (raw)
Introduce a new kfunc bpf_cgroup_read_xattr, which can read xattr from
cgroupfs nodes. The primary users are LSMs, cgroup programs, and sched_ext.
---
Changes v2 => v3:
1. Make bpf_cgroup_read_xattr available to all program types.
2. Fix gcc build warning on the selftests.
3. Add "ifdef CONFIG_CGROUPS" around bpf_cgroup_read_xattr.
v2: https://lore.kernel.org/bpf/20250619220114.3956120-1-song@kernel.org/
Changes v1 => v2:
1. Replace 1/4 in v1 with Chritian's version (1/5 in v2).
2. Rename bpf_kernfs_read_xattr => bpf_cgroup_read_xattr, and limit access
to cgroup only.
3. Add 5/5, which makes bpf_cgroup_read_xattr available to cgroup and
struct_ops programs.
v1: https://lore.kernel.org/bpf/20250618233739.189106-1-song@kernel.org/
Christian Brauner (1):
kernfs: remove iattr_mutex
Song Liu (3):
bpf: Introduce bpf_cgroup_read_xattr to read xattr of cgroup's node
bpf: Mark cgroup_subsys_state->cgroup RCU safe
selftests/bpf: Add tests for bpf_cgroup_read_xattr
fs/bpf_fs_kfuncs.c | 34 ++++
fs/kernfs/inode.c | 74 ++++----
kernel/bpf/helpers.c | 3 +
kernel/bpf/verifier.c | 5 +
.../testing/selftests/bpf/bpf_experimental.h | 3 +
.../selftests/bpf/prog_tests/cgroup_xattr.c | 145 ++++++++++++++++
.../selftests/bpf/progs/cgroup_read_xattr.c | 158 ++++++++++++++++++
.../selftests/bpf/progs/read_cgroupfs_xattr.c | 60 +++++++
8 files changed, 448 insertions(+), 34 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/cgroup_xattr.c
create mode 100644 tools/testing/selftests/bpf/progs/cgroup_read_xattr.c
create mode 100644 tools/testing/selftests/bpf/progs/read_cgroupfs_xattr.c
--
2.47.1
next reply other threads:[~2025-06-23 6:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 6:38 Song Liu [this message]
2025-06-23 6:38 ` [PATCH v3 bpf-next 1/4] kernfs: remove iattr_mutex Song Liu
2025-07-02 10:47 ` André Draszik
2025-07-02 12:17 ` Christian Brauner
2025-07-03 6:28 ` André Draszik
2025-08-16 5:52 ` Jan Kiszka
2025-08-19 10:05 ` Christian Brauner
2025-08-19 10:08 ` [PATCH] kernfs: don't fail listing extended attributes Christian Brauner
2025-06-23 6:38 ` [PATCH v3 bpf-next 2/4] bpf: Introduce bpf_cgroup_read_xattr to read xattr of cgroup's node Song Liu
2025-06-23 6:38 ` [PATCH v3 bpf-next 3/4] bpf: Mark cgroup_subsys_state->cgroup RCU safe Song Liu
2025-06-23 6:38 ` [PATCH v3 bpf-next 4/4] selftests/bpf: Add tests for bpf_cgroup_read_xattr Song Liu
2025-06-23 11:03 ` [PATCH v3 bpf-next 0/4] Introduce bpf_cgroup_read_xattr Christian Brauner
2025-06-27 2:14 ` Alexei Starovoitov
2025-06-27 4:04 ` Song Liu
2025-06-27 15:59 ` Alexei Starovoitov
2025-06-27 16:20 ` Song Liu
2025-07-01 8:32 ` Christian Brauner
2025-07-01 16:23 ` Song Liu
2025-07-02 12:19 ` Christian Brauner
2025-07-01 8:31 ` Christian Brauner
2025-07-01 14:51 ` Alexei Starovoitov
2025-07-02 8:37 ` Christian Brauner
2025-06-27 2:20 ` patchwork-bot+netdevbpf
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=20250623063854.1896364-1-song@kernel.org \
--to=song@kernel.org \
--cc=amir73il@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daan.j.demeyer@gmail.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=kernel-team@meta.com \
--cc=kpsingh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mattbobrowski@google.com \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).