summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--patches/cve/4.9.x.scc2
-rw-r--r--patches/cve/CVE-2019-11478-tcp-refine-memory-limit-test-in-tcp_fragment.patch45
-rw-r--r--patches/cve/CVE-2019-11478-tcp-tcp_fragment-should-apply-sane-memory-limits.patch86
3 files changed, 133 insertions, 0 deletions
diff --git a/patches/cve/4.9.x.scc b/patches/cve/4.9.x.scc
index e3a9067..ad03493 100644
--- a/patches/cve/4.9.x.scc
+++ b/patches/cve/4.9.x.scc
@@ -46,3 +46,5 @@ patch CVE-2018-20836-scsi-libsas-fix-a-race-condition-when-smp-task-timeo.patch
46 46
47#CVEs fixed in 4.9.182: 47#CVEs fixed in 4.9.182:
48patch CVE-2019-11477-tcp-limit-payload-size-of-sacked-skbs.patch 48patch CVE-2019-11477-tcp-limit-payload-size-of-sacked-skbs.patch
49patch CVE-2019-11478-tcp-tcp_fragment-should-apply-sane-memory-limits.patch
50patch CVE-2019-11478-tcp-refine-memory-limit-test-in-tcp_fragment.patch
diff --git a/patches/cve/CVE-2019-11478-tcp-refine-memory-limit-test-in-tcp_fragment.patch b/patches/cve/CVE-2019-11478-tcp-refine-memory-limit-test-in-tcp_fragment.patch
new file mode 100644
index 0000000..57bca2c
--- /dev/null
+++ b/patches/cve/CVE-2019-11478-tcp-refine-memory-limit-test-in-tcp_fragment.patch
@@ -0,0 +1,45 @@
1From caa51edc7e9606418611e68de624efbd0042adf5 Mon Sep 17 00:00:00 2001
2From: Eric Dumazet <edumazet@google.com>
3Date: Fri, 21 Jun 2019 06:09:55 -0700
4Subject: [PATCH] tcp: refine memory limit test in tcp_fragment()
5
6commit b6653b3629e5b88202be3c9abc44713973f5c4b4 upstream.
7
8tcp_fragment() might be called for skbs in the write queue.
9
10Memory limits might have been exceeded because tcp_sendmsg() only
11checks limits at full skb (64KB) boundaries.
12
13Therefore, we need to make sure tcp_fragment() wont punish applications
14that might have setup very low SO_SNDBUF values.
15
16CVE: CVE-2019-11478
17Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.9.y&id=caa51edc7e9606418611e68de624efbd0042adf5]
18
19Fixes: f070ef2ac667 ("tcp: tcp_fragment() should apply sane memory limits")
20Signed-off-by: Eric Dumazet <edumazet@google.com>
21Reported-by: Christoph Paasch <cpaasch@apple.com>
22Tested-by: Christoph Paasch <cpaasch@apple.com>
23Signed-off-by: David S. Miller <davem@davemloft.net>
24Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
26---
27 net/ipv4/tcp_output.c | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
29
30diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
31index d8c6b833f0ce..0c195b0f4216 100644
32--- a/net/ipv4/tcp_output.c
33+++ b/net/ipv4/tcp_output.c
34@@ -1185,7 +1185,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
35 if (nsize < 0)
36 nsize = 0;
37
38- if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf)) {
39+ if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf + 0x20000)) {
40 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPWQUEUETOOBIG);
41 return -ENOMEM;
42 }
43--
442.20.1
45
diff --git a/patches/cve/CVE-2019-11478-tcp-tcp_fragment-should-apply-sane-memory-limits.patch b/patches/cve/CVE-2019-11478-tcp-tcp_fragment-should-apply-sane-memory-limits.patch
new file mode 100644
index 0000000..7d0c4f4
--- /dev/null
+++ b/patches/cve/CVE-2019-11478-tcp-tcp_fragment-should-apply-sane-memory-limits.patch
@@ -0,0 +1,86 @@
1From e358f4af19db46ca25cc9a8a78412b09ba98859d Mon Sep 17 00:00:00 2001
2From: Eric Dumazet <edumazet@google.com>
3Date: Sat, 15 Jun 2019 17:40:56 -0700
4Subject: [PATCH] tcp: tcp_fragment() should apply sane memory limits
5
6commit f070ef2ac66716357066b683fb0baf55f8191a2e upstream.
7
8Jonathan Looney reported that a malicious peer can force a sender
9to fragment its retransmit queue into tiny skbs, inflating memory
10usage and/or overflow 32bit counters.
11
12TCP allows an application to queue up to sk_sndbuf bytes,
13so we need to give some allowance for non malicious splitting
14of retransmit queue.
15
16A new SNMP counter is added to monitor how many times TCP
17did not allow to split an skb if the allowance was exceeded.
18
19Note that this counter might increase in the case applications
20use SO_SNDBUF socket option to lower sk_sndbuf.
21
22CVE-2019-11478 : tcp_fragment, prevent fragmenting a packet when the
23 socket is already using more than half the allowed space
24
25CVE: CVE-2019-11478
26Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.9.y&id=e358f4af19db46ca25cc9a8a78412b09ba98859d]
27
28Signed-off-by: Eric Dumazet <edumazet@google.com>
29Reported-by: Jonathan Looney <jtl@netflix.com>
30Acked-by: Neal Cardwell <ncardwell@google.com>
31Acked-by: Yuchung Cheng <ycheng@google.com>
32Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
33Cc: Bruce Curtis <brucec@netflix.com>
34Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
35Signed-off-by: David S. Miller <davem@davemloft.net>
36Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
37Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
38---
39 include/uapi/linux/snmp.h | 1 +
40 net/ipv4/proc.c | 1 +
41 net/ipv4/tcp_output.c | 5 +++++
42 3 files changed, 7 insertions(+)
43
44diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
45index 3442a26d36d9..56e3460d1f9f 100644
46--- a/include/uapi/linux/snmp.h
47+++ b/include/uapi/linux/snmp.h
48@@ -282,6 +282,7 @@ enum
49 LINUX_MIB_TCPKEEPALIVE, /* TCPKeepAlive */
50 LINUX_MIB_TCPMTUPFAIL, /* TCPMTUPFail */
51 LINUX_MIB_TCPMTUPSUCCESS, /* TCPMTUPSuccess */
52+ LINUX_MIB_TCPWQUEUETOOBIG, /* TCPWqueueTooBig */
53 __LINUX_MIB_MAX
54 };
55
56diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
57index ec48d8eafc7e..8b221398534b 100644
58--- a/net/ipv4/proc.c
59+++ b/net/ipv4/proc.c
60@@ -306,6 +306,7 @@ static const struct snmp_mib snmp4_net_list[] = {
61 SNMP_MIB_ITEM("TCPKeepAlive", LINUX_MIB_TCPKEEPALIVE),
62 SNMP_MIB_ITEM("TCPMTUPFail", LINUX_MIB_TCPMTUPFAIL),
63 SNMP_MIB_ITEM("TCPMTUPSuccess", LINUX_MIB_TCPMTUPSUCCESS),
64+ SNMP_MIB_ITEM("TCPWqueueTooBig", LINUX_MIB_TCPWQUEUETOOBIG),
65 SNMP_MIB_SENTINEL
66 };
67
68diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
69index 2f166662682e..123b2d8fde46 100644
70--- a/net/ipv4/tcp_output.c
71+++ b/net/ipv4/tcp_output.c
72@@ -1185,6 +1185,11 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
73 if (nsize < 0)
74 nsize = 0;
75
76+ if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf)) {
77+ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPWQUEUETOOBIG);
78+ return -ENOMEM;
79+ }
80+
81 if (skb_unclone(skb, gfp))
82 return -ENOMEM;
83
84--
852.20.1
86