Skip to content

security: fixups for the security hooks in sctp

Ondrej Mosnacek linux-sctp linux-security-module lkml netdev selinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest2 patches 10 repliesIn review

Changes in v3 from the cover letter

- patches 1 and 2 dropped as they are already in mainline (not reverted)
- in patch 3, the return value of security_sctp_assoc_established() is changed to int, the call is moved earlier in the function, and if the hook returns an error value, the packet will now be discarded, aborting the association
- patch 4 has been changed a lot - please see the patch description for details on how the hook is now implemented and why

[1] https://github.com/SELinuxProject/selinux-testsuite/
[2] https://patchwork.kernel.org/project/selinux/patch/[email protected]/
[3] https://github.com/sctp/lksctp-tools/tree/master/src/func_tests

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2security: add sctp_assoc_established hookDocumentation/security/SCTP.rst include/linux/lsm_hook_defs.h include/linux/lsm_hooks.h +3 more+37 -150 replies
2/2security: implement sctp_assoc_established hook in selinuxsecurity/selinux/hooks.c+66 -246 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchXin LongRichard Haines
SeriesR-b T-b
1/2Based-on-patch-by
2/2Based-on-patch-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH net v3 0/2] security: fixups for the security hooks in sctp

This is a third round of patches to fix the SCTP-SELinux interaction w.r.t. client-side peeloff. The patches are a modified version of Xin Long's patches posted previously, of which only a part was merged (the rest was merged for a while, but was later reverted):
https://lore.kernel.org/selinux/[email protected]/T/

In gist, these patches replace the call to security_inet_conn_established() in SCTP with a new hook security_sctp_assoc_established() and implement the new hook in SELinux so that the client-side association labels are set correctly (which matters in case the association eventually gets peeled off into a separate socket).

Note that other LSMs than SELinux don't implement the SCTP hooks nor inet_conn_established, so they shouldn't be affected by any of these changes.

These patches were tested by selinux-testsuite [1] with an additional patch [2] and by lksctp-tools func_tests [3].

Changes since v2:
- patches 1 and 2 dropped as they are already in mainline (not reverted)
- in patch 3, the return value of security_sctp_assoc_established() is changed to int, the call is moved earlier in the function, and if the hook returns an error value, the packet will now be discarded, aborting the association
- patch 4 has been changed a lot - please see the patch description for details on how the hook is now implemented and why

[1] https://github.com/SELinuxProject/selinux-testsuite/
[2] https://patchwork.kernel.org/project/selinux/patch/[email protected]/
[3] https://github.com/sctp/lksctp-tools/tree/master/src/func_tests

Ondrej Mosnacek (2):
security: add sctp_assoc_established hook
security: implement sctp_assoc_established hook in selinux

 Documentation/security/SCTP.rst | 22 ++++----
 include/linux/lsm_hook_defs.h   |  2 +
 include/linux/lsm_hooks.h       |  5 ++
 include/linux/security.h        |  8 +++
 net/sctp/sm_statefuns.c         |  8 +--
 security/security.c             |  7 +++
 security/selinux/hooks.c        | 90 ++++++++++++++++++++++++---------
 7 files changed, 103 insertions(+), 39 deletions(-)
Signature · 1 line
2.34.1