Skip to content

Introduce bpf_cgroup_read_xattr

Song Liu bpf linux-fsdevel linux-security-module lkml 2 versions – Applied

Status from this message: Applied to the vfs-6.17.bpf branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 16 repliesApplied 3/4
  2. v25 patches 8 repliesSuperseded

Changes in v3 from the cover letter

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.

Patches in v3 Applied · 3/4

#Subject and filesSizeRepliesApplied
1/4kernfs: remove iattr_mutexfs/kernfs/inode.c+40 -346 replies
2/4bpf: Introduce bpf_cgroup_read_xattr to read xattr of cgroup's nodefs/bpf_fs_kfuncs.c kernel/bpf/helpers.c+37 -00 repliesApplied
3/4bpf: Mark cgroup_subsys_state->cgroup RCU safekernel/bpf/verifier.c+5 -00 repliesApplied
4/4selftests/bpf: Add tests for bpf_cgroup_read_xattrtools/testing/selftests/bpf/bpf_experimental.h tools/testing/selftests/bpf/prog_tests/cgroup_xattr.c tools/testing/selftests/bpf/progs/cgroup_read_xattr.c +1 more+366 -00 repliesApplied

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

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

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

Read the v3 thread

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

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/[email protected]/

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/[email protected]/

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