linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/4] Introduce bpf_kernfs_read_xattr
@ 2025-06-18 23:37 Song Liu
  2025-06-18 23:37 ` [PATCH bpf-next 1/4] kernfs: Add __kernfs_xattr_get for RCU protected access Song Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Song Liu @ 2025-06-18 23:37 UTC (permalink / raw)
  To: bpf, linux-fsdevel, linux-kernel, linux-security-module
  Cc: kernel-team, andrii, eddyz87, ast, daniel, martin.lau, viro,
	brauner, jack, kpsingh, mattbobrowski, amir73il, gregkh, tj,
	daan.j.demeyer, Song Liu

Introduce a new kfunc bpf_kernfs_read_xattr, which can read xattr from
kernfs nodes (cgroupfs, for example). The primary users are LSMs, for
example, from systemd. sched_ext could also use xattrs on cgroupfs nodes.
However, this is not allowed yet, because bpf_kernfs_read_xattr is only
allowed from LSM hooks. The plan is to address sched_ext later (or in a
later revision of this set).

Song Liu (4):
  kernfs: Add __kernfs_xattr_get for RCU protected access
  bpf: Introduce bpf_kernfs_read_xattr to read xattr of kernfs nodes
  bpf: Mark cgroup_subsys_state->cgroup RCU safe
  selftests/bpf: Add tests for bpf_kernfs_read_xattr

 fs/bpf_fs_kfuncs.c                            |  33 ++++
 fs/kernfs/inode.c                             |  14 ++
 include/linux/kernfs.h                        |   2 +
 kernel/bpf/verifier.c                         |   5 +
 .../selftests/bpf/prog_tests/kernfs_xattr.c   | 145 ++++++++++++++++++
 .../selftests/bpf/progs/kernfs_read_xattr.c   | 117 ++++++++++++++
 .../selftests/bpf/progs/read_cgroupfs_xattr.c |  60 ++++++++
 7 files changed, 376 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/kernfs_xattr.c
 create mode 100644 tools/testing/selftests/bpf/progs/kernfs_read_xattr.c
 create mode 100644 tools/testing/selftests/bpf/progs/read_cgroupfs_xattr.c

--
2.47.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-06-21  2:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-18 23:37 [PATCH bpf-next 0/4] Introduce bpf_kernfs_read_xattr Song Liu
2025-06-18 23:37 ` [PATCH bpf-next 1/4] kernfs: Add __kernfs_xattr_get for RCU protected access Song Liu
2025-06-19 10:01   ` Christian Brauner
2025-06-19 10:33     ` Greg Kroah-Hartman
2025-06-19 15:33     ` Song Liu
2025-06-21  2:38     ` Tejun Heo
2025-06-19 13:57   ` kernel test robot
2025-06-18 23:37 ` [PATCH bpf-next 2/4] bpf: Introduce bpf_kernfs_read_xattr to read xattr of kernfs nodes Song Liu
2025-06-19  8:49   ` Christian Brauner
2025-06-18 23:37 ` [PATCH bpf-next 3/4] bpf: Mark cgroup_subsys_state->cgroup RCU safe Song Liu
2025-06-18 23:37 ` [PATCH bpf-next 4/4] selftests/bpf: Add tests for bpf_kernfs_read_xattr Song Liu
2025-06-19  0:43 ` [PATCH bpf-next 0/4] Introduce bpf_kernfs_read_xattr Tejun Heo
2025-06-19  8:48   ` Christian Brauner
2025-06-19 15:31     ` Song Liu

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).