-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SCTP bind/connect mishandling #40
Comments
Well spotted! That restriction on SCTP sockets should be considered a bug because the Complementary to this fix, it would be nice to be able to control SCTP sockets with a new |
Hello Mickaël! I'd like to implement dedicated patch-fix. Please assign this issue to me. |
Do not check TCP access right if socket protocol is not IPPROTO_TCP. LANDLOCK_ACCESS_NET_BIND_TCP and LANDLOCK_ACCESS_NET_CONNECT_TCP should not restrict bind(2) and connect(2) for non-TCP protocols (SCTP, MPTCP, SMC). Closes: landlock-lsm#40 Fixes: fff69fb ("landlock: Support network rules with TCP bind and connect") Signed-off-by: Mikhail Ivanov <[email protected]>
Do not check TCP access right if socket protocol is not IPPROTO_TCP. LANDLOCK_ACCESS_NET_BIND_TCP and LANDLOCK_ACCESS_NET_CONNECT_TCP should not restrict bind(2) and connect(2) for non-TCP protocols (SCTP, MPTCP, SMC). sk_is_tcp() is used for this to check address family of the socket before doing INET-specific address length validation. This is required for error consistency. Closes: landlock-lsm#40 Fixes: fff69fb ("landlock: Support network rules with TCP bind and connect") Signed-off-by: Mikhail Ivanov <[email protected]>
SCTP is connection-oriented protocol that can be used to establish one-to-many and one-to-one communication between endpoints.
One-to-one style can be used by specifying
AF_INET
family,SOCK_STREAM
type andIPPROTO_SCTP
protocol value in the socket(2):Current implementation of
LANDLOCK_ACCESS_NET_BIND_TCP
,LANDLOCK_ACCESS_NET_CONNECT_TCP
allows to restrict bind/connect actions for both classic TCP sockets and SCTP sockets.SCTP allows to bind and connect sockets not only with bind(2), connect(2), but also with setsockopt(3p). Options
SCTP_SOCKOPT_CONNECT*
,SCTP_SOCKOPT_BIND*
, ... (Cf. SCTP) are provided for this purpose.For example:
It is not possible to restrict such calls using
LANDLOCK_ACCESS_NET_BIND_TCP
,LANDLOCK_ACCESS_NET_CONNECT_TCP
which leads to inconsistency of Landlock behavior.There are a few ways to fix this issue:
protocol=0
).security_sctp_bind_connect
(Cf. net/sctp/socket.c).The text was updated successfully, but these errors were encountered: