Skip to content

af_unix: Allow BPF LSM to filter SCM_RIGHTS at sendmsg().

Kuniyuki Iwashima bpf linux-security-module netdev oe-kbuild-all selinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 5 repliesIn review

Changes from the cover letter

v2: Remove SCM_RIGHTS fd scrubbing functionality

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4af_unix: Don't pass struct socket to security_unix_may_send().include/linux/lsm_hook_defs.h include/linux/security.h net/unix/af_unix.c +4 more+23 -230 replies
2/4af_unix: Call security_unix_may_send() in sendmsg() for all socket typesnet/unix/af_unix.c security/landlock/task.c security/selinux/hooks.c +1 more+30 -90 replies
3/4af_unix: Pass skb to security_unix_may_send().include/linux/lsm_hook_defs.h include/linux/security.h net/unix/af_unix.c +4 more+18 -120 replies
4/4selftest: bpf: Add test for BPF LSM on unix_may_send().tools/testing/selftests/bpf/prog_tests/lsm_unix_may_send.c tools/testing/selftests/bpf/progs/lsm_unix_may_send.c+251 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 bpf-next 0/4] af_unix: Allow BPF LSM to filter SCM_RIGHTS at sendmsg().

From: Kuniyuki Iwashima <[email protected]>

Since commit 77cbe1a6d873 ("af_unix: Introduce SO_PASSRIGHTS."), we can disable SCM_RIGHTS per socket, but it's not flexible.

This series allows us to implement more fine-grained filtering for SCM_RIGHTS with BPF LSM.

Changes:
v2: Remove SCM_RIGHTS fd scrubbing functionality

v1: https://lore.kernel.org/bpf/[email protected]/

Kuniyuki Iwashima (4):
af_unix: Don't pass struct socket to security_unix_may_send().
af_unix: Call security_unix_may_send() in sendmsg() for all socket
types
af_unix: Pass skb to security_unix_may_send().
selftest: bpf: Add test for BPF LSM on unix_may_send().

 include/linux/lsm_hook_defs.h                 |   3 +-
 include/linux/security.h                      |   7 +-
 net/unix/af_unix.c                            |  32 ++--
 security/landlock/task.c                      |  16 +-
 security/security.c                           |   5 +-
 security/selinux/hooks.c                      |  14 +-
 security/smack/smack_lsm.c                    |  12 +-
 .../bpf/prog_tests/lsm_unix_may_send.c        | 168 ++++++++++++++++++
 .../selftests/bpf/progs/lsm_unix_may_send.c   |  83 +++++++++
 9 files changed, 309 insertions(+), 31 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/lsm_unix_may_send.c
 create mode 100644 tools/testing/selftests/bpf/progs/lsm_unix_may_send.c
Signature · 1 line
2.49.0