linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux: handle MPTCP consistently with TCP
@ 2020-12-16 11:55 Paolo Abeni
  2020-12-16 16:31 ` Casey Schaufler
  2020-12-23 14:53 ` Paul Moore
  0 siblings, 2 replies; 7+ messages in thread
From: Paolo Abeni @ 2020-12-16 11:55 UTC (permalink / raw)
  To: selinux; +Cc: linux-security-module, mptcp, Stephen Smalley, Paul Moore

The MPTCP protocol uses a specific protocol value, even if
it's an extension to TCP. Additionally, MPTCP sockets
could 'fall-back' to TCP at run-time, depending on peer MPTCP
support and available resources.

As a consequence of the specific protocol number, selinux
applies the raw_socket class to MPTCP sockets.

Existing TCP application converted to MPTCP - or forced to
use MPTCP socket with user-space hacks - will need an
updated policy to run successfully.

This change lets selinux attach the TCP socket class to
MPTCP sockets, too, so that no policy changes are needed in
the above scenario.

Note that the MPTCP is setting, propagating and updating the
security context on all the subflows and related request
socket.

Link: https://lore.kernel.org/linux-security-module/CAHC9VhTaK3xx0hEGByD2zxfF7fadyPP1kb-WeWH_YCyq9X-sRg@mail.gmail.com/T/#t
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 security/selinux/hooks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 6fa593006802..451bded67d9c 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1120,7 +1120,8 @@ static inline u16 inode_mode_to_security_class(umode_t mode)
 
 static inline int default_protocol_stream(int protocol)
 {
-	return (protocol == IPPROTO_IP || protocol == IPPROTO_TCP);
+	return (protocol == IPPROTO_IP || protocol == IPPROTO_TCP ||
+		protocol == IPPROTO_MPTCP);
 }
 
 static inline int default_protocol_dgram(int protocol)
-- 
2.26.2


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

end of thread, other threads:[~2021-01-05  0:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-16 11:55 [PATCH] linux: handle MPTCP consistently with TCP Paolo Abeni
2020-12-16 16:31 ` Casey Schaufler
2020-12-16 17:22   ` Paolo Abeni
2020-12-23 14:53 ` Paul Moore
2020-12-23 15:10   ` Paolo Abeni
2020-12-23 15:28     ` Paul Moore
2021-01-05  0:47   ` 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).