Skip to content

Introduce bpf_kernfs_read_xattr

Song Liu bpf linux-fsdevel linux-security-module lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4kernfs: Add __kernfs_xattr_get for RCU protected accessfs/kernfs/inode.c include/linux/kernfs.h+16 -04 replies
2/4bpf: Introduce bpf_kernfs_read_xattr to read xattr of kernfs nodesfs/bpf_fs_kfuncs.c+33 -01 reply
3/4bpf: Mark cgroup_subsys_state->cgroup RCU safekernel/bpf/verifier.c+5 -00 replies
4/4selftests/bpf: Add tests for bpf_kernfs_read_xattrtools/testing/selftests/bpf/prog_tests/kernfs_xattr.c tools/testing/selftests/bpf/progs/kernfs_read_xattr.c tools/testing/selftests/bpf/progs/read_cgroupfs_xattr.c+322 -00 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchGreg Kroah-HartmanTejun Heo
1/4A-b A-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH bpf-next 0/4] Introduce bpf_kernfs_read_xattr

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