bpf: Add BPF_MAP_TYPE_CRED_STORAGE support
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 10 repliesIn review
- v12 patches 2 repliesSuperseded
Changes in v2 from the cover letter
- fix kernel ci build error
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: Add BPF_MAP_TYPE_CRED_STORAGE map type and kfuncsinclude/ include/ include/ +5 more | +228 | 10 replies | |
| 2/2 | selftests/bpf: Add cred local storage teststools/ tools/ | +139 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] bpf: Add BPF_MAP_TYPE_CRED_STORAGE support
This series adds BPF_MAP_TYPE_CRED_STORAGE, enabling BPF programs to associate data with credential structures (struct cred).
Like other local storage types (task, inode, sk), this provides automatic lifecycle management and is useful for LSM programs tracking credential state across LSM calls. Lifetime management is necessary for detecting credential leaks and enforcing time-based security policies.
The implementation uses kfuncs (bpf_cred_storage_get/delete) that return bpf_local_storage_data pointers, with map values accessible via the data field.
v2:
- fix kernel ci build error
David Windsor (2):
bpf: Add BPF_MAP_TYPE_CRED_STORAGE map type and kfuncs selftests/bpf: Add cred local storage tests
include/linux/bpf_lsm.h | 35 ++++ include/linux/bpf_types.h | 1 + include/uapi/linux/bpf.h | 1 + kernel/bpf/Makefile | 1 + kernel/bpf/bpf_cred_storage.c | 175 ++++++++++++++++++ kernel/bpf/syscall.c | 10 +- kernel/cred.c | 7 + security/bpf/hooks.c | 1 + .../selftests/bpf/prog_tests/cred_storage.c | 52 ++++++ .../selftests/bpf/progs/cred_storage.c | 87 +++++++++ 10 files changed, 367 insertions(+), 3 deletions(-) create mode 100644 kernel/bpf/bpf_cred_storage.c create mode 100644 tools/testing/selftests/bpf/prog_tests/cred_storage.c create mode 100644 tools/testing/selftests/bpf/progs/cred_storage.c
Signature · 1 line
2.43.0