All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] bpf: Add BPF_MAP_TYPE_CRED_STORAGE support
@ 2025-09-12 22:25 David Windsor
  2025-09-12 22:25 ` [PATCH 1/2] bpf: Add BPF_MAP_TYPE_CRED_STORAGE map type and kfuncs David Windsor
  2025-09-12 22:25 ` [PATCH 2/2] selftests/bpf: Add cred local storage tests David Windsor
  0 siblings, 2 replies; 13+ messages in thread
From: David Windsor @ 2025-09-12 22:25 UTC (permalink / raw)
  To: bpf
  Cc: linux-kernel, martin.lau, ast, daniel, andrii, eddyz87, song,
	yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
	dwindsor

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

-- 
2.43.0


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

end of thread, other threads:[~2025-09-16 19:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-12 22:25 [PATCH v2 0/2] bpf: Add BPF_MAP_TYPE_CRED_STORAGE support David Windsor
2025-09-12 22:25 ` [PATCH 1/2] bpf: Add BPF_MAP_TYPE_CRED_STORAGE map type and kfuncs David Windsor
2025-09-13  0:11   ` Song Liu
2025-09-13  0:26     ` David Windsor
2025-09-13 21:58       ` Song Liu
     [not found]         ` <CAEXv5_g2xMwSXGJ=X1FEiA8_YQnSXKwHFW3Cv5Ki5wwLkhAfuA@mail.gmail.com>
2025-09-15  1:09           ` Alexei Starovoitov
2025-09-15  2:10             ` David Windsor
2025-09-16 15:25               ` David Windsor
2025-09-16 16:16                 ` Song Liu
2025-09-16 16:36                   ` David Windsor
2025-09-16 17:47                     ` Song Liu
     [not found]                       ` <CAEXv5_h=DoexdK4ZtFGS1Ya3NSM146qxxKyLhO9R736TS7=idg@mail.gmail.com>
2025-09-16 19:36                         ` Song Liu
2025-09-12 22:25 ` [PATCH 2/2] selftests/bpf: Add cred local storage tests David Windsor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.