summaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2020-12-16 12:55:27 +0100
committerPaul Moore <paul@paul-moore.com>2021-01-04 19:43:59 -0500
commit95ca90726ea6c9444c752ea370e35ec7b6776434 (patch)
tree5d512809bcd8eecce82ded279012da46575ee8f2 /security/selinux
parente71ba9452f0b5b2e8dc8aa5445198cd9214a6a62 (diff)
downloadlinux-stable-95ca90726ea6c9444c752ea370e35ec7b6776434.tar.gz
linux-stable-95ca90726ea6c9444c752ea370e35ec7b6776434.tar.bz2
linux-stable-95ca90726ea6c9444c752ea370e35ec7b6776434.zip
selinux: handle MPTCP consistently with TCP
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> [PM: tweaked subject's prefix] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/hooks.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 644b17ec9e63..75e7568cf607 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)