]> Git Repo - linux.git/commit
security: implement sctp_assoc_established hook in selinux
authorXin Long <[email protected]>
Tue, 2 Nov 2021 12:02:50 +0000 (08:02 -0400)
committerDavid S. Miller <[email protected]>
Wed, 3 Nov 2021 11:09:20 +0000 (11:09 +0000)
commite7310c94024cdf099c0d29e6903dd6fe9205bb60
tree8340d44e4090a192e8ce269bcf7cfa759425501c
parent7c2ef0240e6abfd3cc59511339517358350a8910
security: implement sctp_assoc_established hook in selinux

Different from selinux_inet_conn_established(), it also gives the
secid to asoc->peer_secid in selinux_sctp_assoc_established(),
as one UDP-type socket may have more than one asocs.

Note that peer_secid in asoc will save the peer secid for this
asoc connection, and peer_sid in sksec will just keep the peer
secid for the latest connection. So the right use should be do
peeloff for UDP-type socket if there will be multiple asocs in
one socket, so that the peeloff socket has the right label for
its asoc.

v1->v2:
  - call selinux_inet_conn_established() to reduce some code
    duplication in selinux_sctp_assoc_established(), as Ondrej
    suggested.
  - when doing peeloff, it calls sock_create() where it actually
    gets secid for socket from socket_sockcreate_sid(). So reuse
    SECSID_WILD to ensure the peeloff socket keeps using that
    secid after calling selinux_sctp_sk_clone() for client side.

Fixes: 72e89f50084c ("security: Add support for SCTP security hooks")
Reported-by: Prashanth Prahlad <[email protected]>
Reviewed-by: Richard Haines <[email protected]>
Tested-by: Richard Haines <[email protected]>
Signed-off-by: Xin Long <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
security/selinux/hooks.c
This page took 0.046449 seconds and 4 git commands to generate.