linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 bpf-next 0/2] security: Propagate caller information in bpf hooks
@ 2025-03-04 20:30 Blaise Boscaccy
  2025-03-04 20:30 ` [PATCH v4 bpf-next 1/2] " Blaise Boscaccy
  2025-03-04 20:30 ` [PATCH v4 bpf-next 2/2] selftests/bpf: Add is_kernel parameter to LSM/bpf test programs Blaise Boscaccy
  0 siblings, 2 replies; 15+ messages in thread
From: Blaise Boscaccy @ 2025-03-04 20:30 UTC (permalink / raw)
  To: Paul Moore, James Morris, Serge E. Hallyn, Alexei Starovoitov,
	Daniel Borkmann, John Fastabend, Andrii Nakryiko,
	Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Stephen Smalley,
	Ondrej Mosnacek, linux-security-module, linux-kernel, bpf,
	selinux, bboscaccy

Hello,

While trying to implement an eBPF gatekeeper program, we ran into an
issue whereas the LSM hooks are missing some relevant data.

Certain subcommands passed to the bpf() syscall can be invoked from
either the kernel or userspace. Additionally, some fields in the
bpf_attr struct contain pointers, and depending on where the
subcommand was invoked, they could point to either user or kernel
memory. One example of this is the bpf_prog_load subcommand and its
fd_array. This data is made available and used by the verifier but not
made available to the LSM subsystem. This patchset simply exposes that
information to applicable LSM hooks.

Change list:
- v3 -> v4
  - split out selftest changes into a separate patch
- v2 -> v3
  - reorder params so that the new boolean flag is the last param
  - fixup function signatures in bpf selftests
- v1 -> v2
  - Pass a boolean flag in lieu of bpfptr_t

Revisions:
- v3
  https://lore.kernel.org/bpf/20250303222416.3909228-1-bboscaccy@linux.microsoft.com/
- v2
  https://lore.kernel.org/bpf/20250228165322.3121535-1-bboscaccy@linux.microsoft.com/
- v1
  https://lore.kernel.org/bpf/20250226003055.1654837-1-bboscaccy@linux.microsoft.com/


Blaise Boscaccy (2):
  security: Propagate caller information in bpf hooks
  selftests/bpf: Add is_kernel parameter to LSM/bpf test programs

 include/linux/lsm_hook_defs.h                     |  6 +++---
 include/linux/security.h                          | 12 ++++++------
 kernel/bpf/syscall.c                              | 10 +++++-----
 security/security.c                               | 15 +++++++++------
 security/selinux/hooks.c                          |  6 +++---
 tools/testing/selftests/bpf/progs/rcu_read_lock.c |  3 ++-
 .../selftests/bpf/progs/test_cgroup1_hierarchy.c  |  4 ++--
 .../selftests/bpf/progs/test_kfunc_dynptr_param.c |  6 +++---
 .../testing/selftests/bpf/progs/test_lookup_key.c |  2 +-
 .../selftests/bpf/progs/test_ptr_untrusted.c      |  2 +-
 .../selftests/bpf/progs/test_task_under_cgroup.c  |  2 +-
 .../selftests/bpf/progs/test_verify_pkcs7_sig.c   |  2 +-
 12 files changed, 37 insertions(+), 33 deletions(-)

-- 
2.48.1


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

end of thread, other threads:[~2025-03-05 20:12 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-04 20:30 [PATCH v4 bpf-next 0/2] security: Propagate caller information in bpf hooks Blaise Boscaccy
2025-03-04 20:30 ` [PATCH v4 bpf-next 1/2] " Blaise Boscaccy
2025-03-05  0:46   ` Paul Moore
2025-03-04 20:30 ` [PATCH v4 bpf-next 2/2] selftests/bpf: Add is_kernel parameter to LSM/bpf test programs Blaise Boscaccy
2025-03-04 23:19   ` Song Liu
2025-03-05  0:36     ` Blaise Boscaccy
2025-03-05  3:27       ` Song Liu
2025-03-05  0:40   ` Paul Moore
2025-03-05  1:25     ` Blaise Boscaccy
2025-03-05  2:14       ` Paul Moore
2025-03-05  3:32         ` Song Liu
2025-03-05 16:12           ` Paul Moore
2025-03-05 17:08             ` Alexei Starovoitov
2025-03-05 17:20               ` Song Liu
2025-03-05 20:12               ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).