summaryrefslogtreecommitdiff
path: root/net/tls
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2018-08-16 21:49:06 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-15 09:45:29 +0200
commit0c02e0c3fd13f9b6eb4b5f7ce3b739e7c348ae2b (patch)
treeffc008564d2f04428e80adcb9d74d7f8244d1e4b /net/tls
parent58de2cef2b6834dce6d2c7014215739603d43eab (diff)
tcp, ulp: add alias for all ulp modules
[ Upstream commit 037b0b86ecf5646f8eae777d8b52ff8b401692ec ] Lets not turn the TCP ULP lookup into an arbitrary module loader as we only intend to load ULP modules through this mechanism, not other unrelated kernel modules: [root@bar]# cat foo.c #include <sys/types.h> #include <sys/socket.h> #include <linux/tcp.h> #include <linux/in.h> int main(void) { int sock = socket(PF_INET, SOCK_STREAM, 0); setsockopt(sock, IPPROTO_TCP, TCP_ULP, "sctp", sizeof("sctp")); return 0; } [root@bar]# gcc foo.c -O2 -Wall [root@bar]# lsmod | grep sctp [root@bar]# ./a.out [root@bar]# lsmod | grep sctp sctp 1077248 4 libcrc32c 16384 3 nf_conntrack,nf_nat,sctp [root@bar]# Fix it by adding module alias to TCP ULP modules, so probing module via request_module() will be limited to tcp-ulp-[name]. The existing modules like kTLS will load fine given tcp-ulp-tls alias, but others will fail to load: [root@bar]# lsmod | grep sctp [root@bar]# ./a.out [root@bar]# lsmod | grep sctp [root@bar]# Sockmap is not affected from this since it's either built-in or not. Fixes: 734942cc4ea6 ("tcp: ULP infrastructure") Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/tls')
-rw-r--r--net/tls/tls_main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index ffb1a3a69bdd..055b9992d8c7 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -44,6 +44,7 @@
MODULE_AUTHOR("Mellanox Technologies");
MODULE_DESCRIPTION("Transport Layer Security Support");
MODULE_LICENSE("Dual BSD/GPL");
+MODULE_ALIAS_TCP_ULP("tls");
static struct proto tls_base_prot;
static struct proto tls_sw_prot;