Enable writing xattr from BPF programs
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v12 Latest5 patches 2 repliesIn review
- v117 patches 8 repliesSuperseded
- v107 patches 1 replySuperseded
Earlier versions · 9
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v9 | 7 patches | 3 replies | Superseded | |
| v8 | 7 patches | 4 replies | Superseded | |
| v7 | 7 patches | 0 replies | Superseded | |
| v6 | 7 patches | 1 reply | Superseded | |
| v5 | 5 patches | 5 replies | Superseded | |
| v4 | 6 patches | 5 replies | Superseded | |
| v3 | 6 patches | 5 replies | Superseded | |
| v2 | 2 patches | 0 replies | Superseded | |
| v1 | 2 patches | 22 replies | Superseded |
Changes in v12 from the cover letter
1. Drop btf_kfunc_id_set.remap and changes for bpf_dynptr_from_skb. (Alexei)
2. Minor refactoring in patch 1. (Matt Bobrowski)
Patches in v12 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | fs/xattr: bpf: Introduce security.bpf. xattr name prefixfs/ include/ | +29 | 0 replies | |
| 2/5 | selftests/bpf: Extend test fs_kfuncs to cover security.bpf. xattr namestools/ tools/ | +51 | 0 replies | |
| 3/5 | bpf: lsm: Add two more sleepable hookskernel/ | +2 | 1 reply | |
| 4/5 | bpf: fs/xattr: Add BPF kfuncs to set and remove xattrsfs/ include/ kernel/ | +228 | 1 reply | |
| 5/5 | selftests/bpf: Test kfuncs that set and remove xattr from BPF programstools/ tools/ tools/ | +263 | 0 replies |
Reviews trailers per patch
3 of 5 patches have a Reviewed-by or Acked-by.
| Patch | Christian Brauner | Jan Kara | Matt Bobrowski |
|---|---|---|---|
| 1/5 | A-b | R-b | R-b |
| 2/5 | |||
| 3/5 | R-b | ||
| 4/5 | A-b | R-b | |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v12 bpf-next 0/5] Enable writing xattr from BPF programs
Add support to set and remove xattr from BPF program. Also add security.bpf. xattr name prefix.
kfuncs are added to set and remove xattrs with security.bpf. name prefix. Update kfuncs bpf_get_[file|dentry]_xattr to read xattrs with security.bpf. name prefix. Note that BPF programs can read user. xattrs, but not write and remove them.
To pick the right version of kfunc to use, a remap logic is added to btf_kfunc_id_set. This helps move some kfunc specific logic off the verifier core code. Also use this remap logic to select bpf_dynptr_from_skb or bpf_dynptr_from_skb_rdonly.
Cover letter of v1 and v2:
Follow up discussion in LPC 2024 [1], that we need security.bpf xattr prefix. This set adds "security.bpf." xattr name prefix, and allows bpf kfuncs bpf_get_[file|dentry]_xattr() to read these xattrs.
[1] https://lpc.events/event/18/contributions/1940/
---
Changes v11 => v12:
1. Drop btf_kfunc_id_set.remap and changes for bpf_dynptr_from_skb. (Alexei)
2. Minor refactoring in patch 1. (Matt Bobrowski)
v11: https://lore.kernel.org/bpf/[email protected]/
Changes v10 => v11:
1. Add Acked-by from Christian Brauner.
2. Fix selftests build error like this one:
https://github.com/kernel-patches/bpf/actions/runs/13022268618/job/36325472992
3. Rename some variables in the selftests.
v10: https://lore.kernel.org/bpf/[email protected]/
Changes v9 => v10:
1. Refactor bpf_[set|remove]_dentry_xattr[_locked]. (Christian Brauner).
v9: https://lore.kernel.org/bpf/[email protected]/
Changes v8 => v9
1. Fix build for CONFIG_DEBUG_INFO_BTF=n case. (kernel test robot)
v8: https://lore.kernel.org/bpf/[email protected]/
Changes v7 => v8
1. Rebase and resolve conflicts.
v7: https://lore.kernel.org/bpf/[email protected]/
Changes v6 => v7
1. Move btf_kfunc_id_remap() to the right place. (Bug reported by CI)
v6: https://lore.kernel.org/bpf/[email protected]/
Changes v5 => v6
1. Hide _locked version of the kfuncs from vmlinux.h (Alexei)
2. Add remap logic to btf_kfunc_id_set and use that to pick the correct version of kfuncs to use.
3. Also use the remap logic for bpf_dynptr_from_skb[|_rdonly].
v5: https://lore.kernel.org/bpf/[email protected]/
Changes v4 => v5
1. Let verifier pick proper kfunc (_locked or not _locked) based on the calling context. (Alexei)
2. Remove the __failure test (6/6 of v4).
v4: https://lore.kernel.org/bpf/[email protected]/
Changes v3 => v4
1. Do write permission check with inode locked. (Jan Kara)
2. Fix some source_inline warnings.
v3: https://lore.kernel.org/bpf/[email protected]/
Changes v2 => v3
1. Add kfuncs to set and remove xattr from BPF programs.
v2: https://lore.kernel.org/bpf/[email protected]/
Changes v1 => v2
1. Update comment of bpf_get_[file|dentry]_xattr. (Jiri Olsa)
2. Fix comment for return value of bpf_get_[file|dentry]_xattr.
v1: https://lore.kernel.org/bpf/[email protected]/
Song Liu (5):
fs/xattr: bpf: Introduce security.bpf. xattr name prefix selftests/bpf: Extend test fs_kfuncs to cover security.bpf. xattr
names
bpf: lsm: Add two more sleepable hooks
bpf: fs/xattr: Add BPF kfuncs to set and remove xattrs selftests/bpf: Test kfuncs that set and remove xattr from BPF programs
fs/bpf_fs_kfuncs.c | 225 +++++++++++++++++- include/linux/bpf_lsm.h | 18 ++ include/uapi/linux/xattr.h | 4 + kernel/bpf/bpf_lsm.c | 2 + kernel/bpf/verifier.c | 21 ++ tools/testing/selftests/bpf/bpf_kfuncs.h | 5 + .../selftests/bpf/prog_tests/fs_kfuncs.c | 162 ++++++++++++- .../selftests/bpf/progs/test_get_xattr.c | 28 ++- .../bpf/progs/test_set_remove_xattr.c | 133 +++++++++++ 9 files changed, 573 insertions(+), 25 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/test_set_remove_xattr.c
--
2.43.5