]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Apr 2019 08:49:38 +0000 (10:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Apr 2019 08:49:38 +0000 (10:49 +0200)
added patches:
alsa-seq-fix-oob-reads-from-strlcpy.patch
ip6_tunnel-match-to-arphrd_tunnel6-for-dev-type.patch
ipv6-fix-dangling-pointer-when-ipv6-fragment.patch
ipv6-sit-reset-ip-header-pointer-in-ipip6_rcv.patch
net-ethtool-not-call-vzalloc-for-zero-sized-memory-request.patch
net-rds-force-to-destroy-connection-if-t_sock-is-null-in-rds_tcp_kill_sock.patch
netns-provide-pure-entropy-for-net_hash_mix.patch
openvswitch-fix-flow-actions-reallocation.patch
qmi_wwan-add-olicard-600.patch
sctp-initialize-_pad-of-sockaddr_in-before-copying-to-user-memory.patch
tcp-ensure-dctcp-reacts-to-losses.patch
tty-ldisc-add-sysctl-to-prevent-autoloading-of-ldiscs.patch
tty-mark-siemens-r3964-line-discipline-as-broken.patch

14 files changed:
queue-4.4/alsa-seq-fix-oob-reads-from-strlcpy.patch [new file with mode: 0644]
queue-4.4/ip6_tunnel-match-to-arphrd_tunnel6-for-dev-type.patch [new file with mode: 0644]
queue-4.4/ipv6-fix-dangling-pointer-when-ipv6-fragment.patch [new file with mode: 0644]
queue-4.4/ipv6-sit-reset-ip-header-pointer-in-ipip6_rcv.patch [new file with mode: 0644]
queue-4.4/net-ethtool-not-call-vzalloc-for-zero-sized-memory-request.patch [new file with mode: 0644]
queue-4.4/net-rds-force-to-destroy-connection-if-t_sock-is-null-in-rds_tcp_kill_sock.patch [new file with mode: 0644]
queue-4.4/netns-provide-pure-entropy-for-net_hash_mix.patch [new file with mode: 0644]
queue-4.4/openvswitch-fix-flow-actions-reallocation.patch [new file with mode: 0644]
queue-4.4/qmi_wwan-add-olicard-600.patch [new file with mode: 0644]
queue-4.4/sctp-initialize-_pad-of-sockaddr_in-before-copying-to-user-memory.patch [new file with mode: 0644]
queue-4.4/series
queue-4.4/tcp-ensure-dctcp-reacts-to-losses.patch [new file with mode: 0644]
queue-4.4/tty-ldisc-add-sysctl-to-prevent-autoloading-of-ldiscs.patch [new file with mode: 0644]
queue-4.4/tty-mark-siemens-r3964-line-discipline-as-broken.patch [new file with mode: 0644]

diff --git a/queue-4.4/alsa-seq-fix-oob-reads-from-strlcpy.patch b/queue-4.4/alsa-seq-fix-oob-reads-from-strlcpy.patch
new file mode 100644 (file)
index 0000000..5c88967
--- /dev/null
@@ -0,0 +1,52 @@
+From 212ac181c158c09038c474ba68068be49caecebb Mon Sep 17 00:00:00 2001
+From: Zubin Mithra <zsm@chromium.org>
+Date: Thu, 4 Apr 2019 14:33:55 -0700
+Subject: ALSA: seq: Fix OOB-reads from strlcpy
+
+From: Zubin Mithra <zsm@chromium.org>
+
+commit 212ac181c158c09038c474ba68068be49caecebb upstream.
+
+When ioctl calls are made with non-null-terminated userspace strings,
+strlcpy causes an OOB-read from within strlen. Fix by changing to use
+strscpy instead.
+
+Signed-off-by: Zubin Mithra <zsm@chromium.org>
+Reviewed-by: Guenter Roeck <groeck@chromium.org>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/core/seq/seq_clientmgr.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/sound/core/seq/seq_clientmgr.c
++++ b/sound/core/seq/seq_clientmgr.c
+@@ -1249,7 +1249,7 @@ static int snd_seq_ioctl_set_client_info
+       /* fill the info fields */
+       if (client_info.name[0])
+-              strlcpy(client->name, client_info.name, sizeof(client->name));
++              strscpy(client->name, client_info.name, sizeof(client->name));
+       client->filter = client_info.filter;
+       client->event_lost = client_info.event_lost;
+@@ -1558,7 +1558,7 @@ static int snd_seq_ioctl_create_queue(st
+       /* set queue name */
+       if (! info.name[0])
+               snprintf(info.name, sizeof(info.name), "Queue-%d", q->queue);
+-      strlcpy(q->name, info.name, sizeof(q->name));
++      strscpy(q->name, info.name, sizeof(q->name));
+       snd_use_lock_free(&q->use_lock);
+       if (copy_to_user(arg, &info, sizeof(info)))
+@@ -1636,7 +1636,7 @@ static int snd_seq_ioctl_set_queue_info(
+               queuefree(q);
+               return -EPERM;
+       }
+-      strlcpy(q->name, info.name, sizeof(q->name));
++      strscpy(q->name, info.name, sizeof(q->name));
+       queuefree(q);
+       return 0;
diff --git a/queue-4.4/ip6_tunnel-match-to-arphrd_tunnel6-for-dev-type.patch b/queue-4.4/ip6_tunnel-match-to-arphrd_tunnel6-for-dev-type.patch
new file mode 100644 (file)
index 0000000..29b26f1
--- /dev/null
@@ -0,0 +1,50 @@
+From foo@baz Mon Apr 15 07:47:06 CEST 2019
+From: Sheena Mira-ato <sheena.mira-ato@alliedtelesis.co.nz>
+Date: Mon, 1 Apr 2019 13:04:42 +1300
+Subject: ip6_tunnel: Match to ARPHRD_TUNNEL6 for dev type
+
+From: Sheena Mira-ato <sheena.mira-ato@alliedtelesis.co.nz>
+
+[ Upstream commit b2e54b09a3d29c4db883b920274ca8dca4d9f04d ]
+
+The device type for ip6 tunnels is set to
+ARPHRD_TUNNEL6. However, the ip4ip6_err function
+is expecting the device type of the tunnel to be
+ARPHRD_TUNNEL.  Since the device types do not
+match, the function exits and the ICMP error
+packet is not sent to the originating host. Note
+that the device type for IPv4 tunnels is set to
+ARPHRD_TUNNEL.
+
+Fix is to expect a tunnel device type of
+ARPHRD_TUNNEL6 instead.  Now the tunnel device
+type matches and the ICMP error packet is sent
+to the originating host.
+
+Signed-off-by: Sheena Mira-ato <sheena.mira-ato@alliedtelesis.co.nz>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/ip6_tunnel.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/net/ipv6/ip6_tunnel.c
++++ b/net/ipv6/ip6_tunnel.c
+@@ -622,7 +622,7 @@ ip4ip6_err(struct sk_buff *skb, struct i
+                                          IPPROTO_IPIP,
+                                          RT_TOS(eiph->tos), 0);
+               if (IS_ERR(rt) ||
+-                  rt->dst.dev->type != ARPHRD_TUNNEL) {
++                  rt->dst.dev->type != ARPHRD_TUNNEL6) {
+                       if (!IS_ERR(rt))
+                               ip_rt_put(rt);
+                       goto out;
+@@ -632,7 +632,7 @@ ip4ip6_err(struct sk_buff *skb, struct i
+               ip_rt_put(rt);
+               if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos,
+                                  skb2->dev) ||
+-                  skb_dst(skb2)->dev->type != ARPHRD_TUNNEL)
++                  skb_dst(skb2)->dev->type != ARPHRD_TUNNEL6)
+                       goto out;
+       }
diff --git a/queue-4.4/ipv6-fix-dangling-pointer-when-ipv6-fragment.patch b/queue-4.4/ipv6-fix-dangling-pointer-when-ipv6-fragment.patch
new file mode 100644 (file)
index 0000000..91f218d
--- /dev/null
@@ -0,0 +1,59 @@
+From foo@baz Mon Apr 15 09:48:20 CEST 2019
+From: Junwei Hu <hujunwei4@huawei.com>
+Date: Tue, 2 Apr 2019 19:38:04 +0800
+Subject: ipv6: Fix dangling pointer when ipv6 fragment
+
+From: Junwei Hu <hujunwei4@huawei.com>
+
+[ Upstream commit ef0efcd3bd3fd0589732b67fb586ffd3c8705806 ]
+
+At the beginning of ip6_fragment func, the prevhdr pointer is
+obtained in the ip6_find_1stfragopt func.
+However, all the pointers pointing into skb header may change
+when calling skb_checksum_help func with
+skb->ip_summed = CHECKSUM_PARTIAL condition.
+The prevhdr pointe will be dangling if it is not reloaded after
+calling __skb_linearize func in skb_checksum_help func.
+
+Here, I add a variable, nexthdr_offset, to evaluate the offset,
+which does not changes even after calling __skb_linearize func.
+
+Fixes: 405c92f7a541 ("ipv6: add defensive check for CHECKSUM_PARTIAL skbs in ip_fragment")
+Signed-off-by: Junwei Hu <hujunwei4@huawei.com>
+Reported-by: Wenhao Zhang <zhangwenhao8@huawei.com>
+Reported-by: syzbot+e8ce541d095e486074fc@syzkaller.appspotmail.com
+Reviewed-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
+Acked-by: Martin KaFai Lau <kafai@fb.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/ip6_output.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/net/ipv6/ip6_output.c
++++ b/net/ipv6/ip6_output.c
+@@ -575,7 +575,7 @@ int ip6_fragment(struct net *net, struct
+                               inet6_sk(skb->sk) : NULL;
+       struct ipv6hdr *tmp_hdr;
+       struct frag_hdr *fh;
+-      unsigned int mtu, hlen, left, len;
++      unsigned int mtu, hlen, left, len, nexthdr_offset;
+       int hroom, troom;
+       __be32 frag_id;
+       int ptr, offset = 0, err = 0;
+@@ -586,6 +586,7 @@ int ip6_fragment(struct net *net, struct
+               goto fail;
+       hlen = err;
+       nexthdr = *prevhdr;
++      nexthdr_offset = prevhdr - skb_network_header(skb);
+       mtu = ip6_skb_dst_mtu(skb);
+@@ -620,6 +621,7 @@ int ip6_fragment(struct net *net, struct
+           (err = skb_checksum_help(skb)))
+               goto fail;
++      prevhdr = skb_network_header(skb) + nexthdr_offset;
+       hroom = LL_RESERVED_SPACE(rt->dst.dev);
+       if (skb_has_frag_list(skb)) {
+               int first_len = skb_pagelen(skb);
diff --git a/queue-4.4/ipv6-sit-reset-ip-header-pointer-in-ipip6_rcv.patch b/queue-4.4/ipv6-sit-reset-ip-header-pointer-in-ipip6_rcv.patch
new file mode 100644 (file)
index 0000000..13de33b
--- /dev/null
@@ -0,0 +1,116 @@
+From foo@baz Mon Apr 15 09:48:20 CEST 2019
+From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
+Date: Thu, 4 Apr 2019 16:37:53 +0200
+Subject: ipv6: sit: reset ip header pointer in ipip6_rcv
+
+From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
+
+[ Upstream commit bb9bd814ebf04f579be466ba61fc922625508807 ]
+
+ipip6 tunnels run iptunnel_pull_header on received skbs. This can
+determine the following use-after-free accessing iph pointer since
+the packet will be 'uncloned' running pskb_expand_head if it is a
+cloned gso skb (e.g if the packet has been sent though a veth device)
+
+[  706.369655] BUG: KASAN: use-after-free in ipip6_rcv+0x1678/0x16e0 [sit]
+[  706.449056] Read of size 1 at addr ffffe01b6bd855f5 by task ksoftirqd/1/=
+[  706.669494] Hardware name: HPE ProLiant m400 Server/ProLiant m400 Server, BIOS U02 08/19/2016
+[  706.771839] Call trace:
+[  706.801159]  dump_backtrace+0x0/0x2f8
+[  706.845079]  show_stack+0x24/0x30
+[  706.884833]  dump_stack+0xe0/0x11c
+[  706.925629]  print_address_description+0x68/0x260
+[  706.982070]  kasan_report+0x178/0x340
+[  707.025995]  __asan_report_load1_noabort+0x30/0x40
+[  707.083481]  ipip6_rcv+0x1678/0x16e0 [sit]
+[  707.132623]  tunnel64_rcv+0xd4/0x200 [tunnel4]
+[  707.185940]  ip_local_deliver_finish+0x3b8/0x988
+[  707.241338]  ip_local_deliver+0x144/0x470
+[  707.289436]  ip_rcv_finish+0x43c/0x14b0
+[  707.335447]  ip_rcv+0x628/0x1138
+[  707.374151]  __netif_receive_skb_core+0x1670/0x2600
+[  707.432680]  __netif_receive_skb+0x28/0x190
+[  707.482859]  process_backlog+0x1d0/0x610
+[  707.529913]  net_rx_action+0x37c/0xf68
+[  707.574882]  __do_softirq+0x288/0x1018
+[  707.619852]  run_ksoftirqd+0x70/0xa8
+[  707.662734]  smpboot_thread_fn+0x3a4/0x9e8
+[  707.711875]  kthread+0x2c8/0x350
+[  707.750583]  ret_from_fork+0x10/0x18
+
+[  707.811302] Allocated by task 16982:
+[  707.854182]  kasan_kmalloc.part.1+0x40/0x108
+[  707.905405]  kasan_kmalloc+0xb4/0xc8
+[  707.948291]  kasan_slab_alloc+0x14/0x20
+[  707.994309]  __kmalloc_node_track_caller+0x158/0x5e0
+[  708.053902]  __kmalloc_reserve.isra.8+0x54/0xe0
+[  708.108280]  __alloc_skb+0xd8/0x400
+[  708.150139]  sk_stream_alloc_skb+0xa4/0x638
+[  708.200346]  tcp_sendmsg_locked+0x818/0x2b90
+[  708.251581]  tcp_sendmsg+0x40/0x60
+[  708.292376]  inet_sendmsg+0xf0/0x520
+[  708.335259]  sock_sendmsg+0xac/0xf8
+[  708.377096]  sock_write_iter+0x1c0/0x2c0
+[  708.424154]  new_sync_write+0x358/0x4a8
+[  708.470162]  __vfs_write+0xc4/0xf8
+[  708.510950]  vfs_write+0x12c/0x3d0
+[  708.551739]  ksys_write+0xcc/0x178
+[  708.592533]  __arm64_sys_write+0x70/0xa0
+[  708.639593]  el0_svc_handler+0x13c/0x298
+[  708.686646]  el0_svc+0x8/0xc
+
+[  708.739019] Freed by task 17:
+[  708.774597]  __kasan_slab_free+0x114/0x228
+[  708.823736]  kasan_slab_free+0x10/0x18
+[  708.868703]  kfree+0x100/0x3d8
+[  708.905320]  skb_free_head+0x7c/0x98
+[  708.948204]  skb_release_data+0x320/0x490
+[  708.996301]  pskb_expand_head+0x60c/0x970
+[  709.044399]  __iptunnel_pull_header+0x3b8/0x5d0
+[  709.098770]  ipip6_rcv+0x41c/0x16e0 [sit]
+[  709.146873]  tunnel64_rcv+0xd4/0x200 [tunnel4]
+[  709.200195]  ip_local_deliver_finish+0x3b8/0x988
+[  709.255596]  ip_local_deliver+0x144/0x470
+[  709.303692]  ip_rcv_finish+0x43c/0x14b0
+[  709.349705]  ip_rcv+0x628/0x1138
+[  709.388413]  __netif_receive_skb_core+0x1670/0x2600
+[  709.446943]  __netif_receive_skb+0x28/0x190
+[  709.497120]  process_backlog+0x1d0/0x610
+[  709.544169]  net_rx_action+0x37c/0xf68
+[  709.589131]  __do_softirq+0x288/0x1018
+
+[  709.651938] The buggy address belongs to the object at ffffe01b6bd85580
+                which belongs to the cache kmalloc-1024 of size 1024
+[  709.804356] The buggy address is located 117 bytes inside of
+                1024-byte region [ffffe01b6bd85580, ffffe01b6bd85980)
+[  709.946340] The buggy address belongs to the page:
+[  710.003824] page:ffff7ff806daf600 count:1 mapcount:0 mapping:ffffe01c4001f600 index:0x0
+[  710.099914] flags: 0xfffff8000000100(slab)
+[  710.149059] raw: 0fffff8000000100 dead000000000100 dead000000000200 ffffe01c4001f600
+[  710.242011] raw: 0000000000000000 0000000000380038 00000001ffffffff 0000000000000000
+[  710.334966] page dumped because: kasan: bad access detected
+
+Fix it resetting iph pointer after iptunnel_pull_header
+
+Fixes: a09a4c8dd1ec ("tunnels: Remove encapsulation offloads on decap")
+Tested-by: Jianlin Shi <jishi@redhat.com>
+Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/sit.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/net/ipv6/sit.c
++++ b/net/ipv6/sit.c
+@@ -693,6 +693,10 @@ static int ipip6_rcv(struct sk_buff *skb
+               if (iptunnel_pull_header(skb, 0, htons(ETH_P_IPV6)))
+                       goto out;
++              /* skb can be uncloned in iptunnel_pull_header, so
++               * old iph is no longer valid
++               */
++              iph = (const struct iphdr *)skb_mac_header(skb);
+               err = IP_ECN_decapsulate(iph, skb);
+               if (unlikely(err)) {
+                       if (log_ecn_error)
diff --git a/queue-4.4/net-ethtool-not-call-vzalloc-for-zero-sized-memory-request.patch b/queue-4.4/net-ethtool-not-call-vzalloc-for-zero-sized-memory-request.patch
new file mode 100644 (file)
index 0000000..0a6c2b1
--- /dev/null
@@ -0,0 +1,85 @@
+From foo@baz Mon Apr 15 07:47:06 CEST 2019
+From: Li RongQing <lirongqing@baidu.com>
+Date: Fri, 29 Mar 2019 09:18:02 +0800
+Subject: net: ethtool: not call vzalloc for zero sized memory request
+
+From: Li RongQing <lirongqing@baidu.com>
+
+[ Upstream commit 3d8830266ffc28c16032b859e38a0252e014b631 ]
+
+NULL or ZERO_SIZE_PTR will be returned for zero sized memory
+request, and derefencing them will lead to a segfault
+
+so it is unnecessory to call vzalloc for zero sized memory
+request and not call functions which maybe derefence the
+NULL allocated memory
+
+this also fixes a possible memory leak if phy_ethtool_get_stats
+returns error, memory should be freed before exit
+
+Signed-off-by: Li RongQing <lirongqing@baidu.com>
+Reviewed-by: Wang Li <wangli39@baidu.com>
+Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/core/ethtool.c |   29 +++++++++++++++++++----------
+ 1 file changed, 19 insertions(+), 10 deletions(-)
+
+--- a/net/core/ethtool.c
++++ b/net/core/ethtool.c
+@@ -1287,17 +1287,22 @@ static int ethtool_get_strings(struct ne
+       gstrings.len = ret;
+-      data = kcalloc(gstrings.len, ETH_GSTRING_LEN, GFP_USER);
+-      if (!data)
+-              return -ENOMEM;
++      if (gstrings.len) {
++              data = kcalloc(gstrings.len, ETH_GSTRING_LEN, GFP_USER);
++              if (!data)
++                      return -ENOMEM;
+-      __ethtool_get_strings(dev, gstrings.string_set, data);
++              __ethtool_get_strings(dev, gstrings.string_set, data);
++      } else {
++              data = NULL;
++      }
+       ret = -EFAULT;
+       if (copy_to_user(useraddr, &gstrings, sizeof(gstrings)))
+               goto out;
+       useraddr += sizeof(gstrings);
+-      if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
++      if (gstrings.len &&
++          copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
+               goto out;
+       ret = 0;
+@@ -1385,17 +1390,21 @@ static int ethtool_get_stats(struct net_
+               return -EFAULT;
+       stats.n_stats = n_stats;
+-      data = kmalloc(n_stats * sizeof(u64), GFP_USER);
+-      if (!data)
+-              return -ENOMEM;
++      if (n_stats) {
++              data = kmalloc(n_stats * sizeof(u64), GFP_USER);
++              if (!data)
++                      return -ENOMEM;
+-      ops->get_ethtool_stats(dev, &stats, data);
++              ops->get_ethtool_stats(dev, &stats, data);
++      } else {
++              data = NULL;
++      }
+       ret = -EFAULT;
+       if (copy_to_user(useraddr, &stats, sizeof(stats)))
+               goto out;
+       useraddr += sizeof(stats);
+-      if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64)))
++      if (n_stats && copy_to_user(useraddr, data, n_stats * sizeof(u64)))
+               goto out;
+       ret = 0;
diff --git a/queue-4.4/net-rds-force-to-destroy-connection-if-t_sock-is-null-in-rds_tcp_kill_sock.patch b/queue-4.4/net-rds-force-to-destroy-connection-if-t_sock-is-null-in-rds_tcp_kill_sock.patch
new file mode 100644 (file)
index 0000000..881a31f
--- /dev/null
@@ -0,0 +1,144 @@
+From foo@baz Mon Apr 15 09:48:20 CEST 2019
+From: Mao Wenan <maowenan@huawei.com>
+Date: Thu, 28 Mar 2019 17:10:56 +0800
+Subject: net: rds: force to destroy connection if t_sock is NULL in rds_tcp_kill_sock().
+
+From: Mao Wenan <maowenan@huawei.com>
+
+[ Upstream commit cb66ddd156203daefb8d71158036b27b0e2caf63 ]
+
+When it is to cleanup net namespace, rds_tcp_exit_net() will call
+rds_tcp_kill_sock(), if t_sock is NULL, it will not call
+rds_conn_destroy(), rds_conn_path_destroy() and rds_tcp_conn_free() to free
+connection, and the worker cp_conn_w is not stopped, afterwards the net is freed in
+net_drop_ns(); While cp_conn_w rds_connect_worker() will call rds_tcp_conn_path_connect()
+and reference 'net' which has already been freed.
+
+In rds_tcp_conn_path_connect(), rds_tcp_set_callbacks() will set t_sock = sock before
+sock->ops->connect, but if connect() is failed, it will call
+rds_tcp_restore_callbacks() and set t_sock = NULL, if connect is always
+failed, rds_connect_worker() will try to reconnect all the time, so
+rds_tcp_kill_sock() will never to cancel worker cp_conn_w and free the
+connections.
+
+Therefore, the condition !tc->t_sock is not needed if it is going to do
+cleanup_net->rds_tcp_exit_net->rds_tcp_kill_sock, because tc->t_sock is always
+NULL, and there is on other path to cancel cp_conn_w and free
+connection. So this patch is to fix this.
+
+rds_tcp_kill_sock():
+...
+if (net != c_net || !tc->t_sock)
+...
+Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
+
+==================================================================
+BUG: KASAN: use-after-free in inet_create+0xbcc/0xd28
+net/ipv4/af_inet.c:340
+Read of size 4 at addr ffff8003496a4684 by task kworker/u8:4/3721
+
+CPU: 3 PID: 3721 Comm: kworker/u8:4 Not tainted 5.1.0 #11
+Hardware name: linux,dummy-virt (DT)
+Workqueue: krdsd rds_connect_worker
+Call trace:
+ dump_backtrace+0x0/0x3c0 arch/arm64/kernel/time.c:53
+ show_stack+0x28/0x38 arch/arm64/kernel/traps.c:152
+ __dump_stack lib/dump_stack.c:77 [inline]
+ dump_stack+0x120/0x188 lib/dump_stack.c:113
+ print_address_description+0x68/0x278 mm/kasan/report.c:253
+ kasan_report_error mm/kasan/report.c:351 [inline]
+ kasan_report+0x21c/0x348 mm/kasan/report.c:409
+ __asan_report_load4_noabort+0x30/0x40 mm/kasan/report.c:429
+ inet_create+0xbcc/0xd28 net/ipv4/af_inet.c:340
+ __sock_create+0x4f8/0x770 net/socket.c:1276
+ sock_create_kern+0x50/0x68 net/socket.c:1322
+ rds_tcp_conn_path_connect+0x2b4/0x690 net/rds/tcp_connect.c:114
+ rds_connect_worker+0x108/0x1d0 net/rds/threads.c:175
+ process_one_work+0x6e8/0x1700 kernel/workqueue.c:2153
+ worker_thread+0x3b0/0xdd0 kernel/workqueue.c:2296
+ kthread+0x2f0/0x378 kernel/kthread.c:255
+ ret_from_fork+0x10/0x18 arch/arm64/kernel/entry.S:1117
+
+Allocated by task 687:
+ save_stack mm/kasan/kasan.c:448 [inline]
+ set_track mm/kasan/kasan.c:460 [inline]
+ kasan_kmalloc+0xd4/0x180 mm/kasan/kasan.c:553
+ kasan_slab_alloc+0x14/0x20 mm/kasan/kasan.c:490
+ slab_post_alloc_hook mm/slab.h:444 [inline]
+ slab_alloc_node mm/slub.c:2705 [inline]
+ slab_alloc mm/slub.c:2713 [inline]
+ kmem_cache_alloc+0x14c/0x388 mm/slub.c:2718
+ kmem_cache_zalloc include/linux/slab.h:697 [inline]
+ net_alloc net/core/net_namespace.c:384 [inline]
+ copy_net_ns+0xc4/0x2d0 net/core/net_namespace.c:424
+ create_new_namespaces+0x300/0x658 kernel/nsproxy.c:107
+ unshare_nsproxy_namespaces+0xa0/0x198 kernel/nsproxy.c:206
+ ksys_unshare+0x340/0x628 kernel/fork.c:2577
+ __do_sys_unshare kernel/fork.c:2645 [inline]
+ __se_sys_unshare kernel/fork.c:2643 [inline]
+ __arm64_sys_unshare+0x38/0x58 kernel/fork.c:2643
+ __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
+ invoke_syscall arch/arm64/kernel/syscall.c:47 [inline]
+ el0_svc_common+0x168/0x390 arch/arm64/kernel/syscall.c:83
+ el0_svc_handler+0x60/0xd0 arch/arm64/kernel/syscall.c:129
+ el0_svc+0x8/0xc arch/arm64/kernel/entry.S:960
+
+Freed by task 264:
+ save_stack mm/kasan/kasan.c:448 [inline]
+ set_track mm/kasan/kasan.c:460 [inline]
+ __kasan_slab_free+0x114/0x220 mm/kasan/kasan.c:521
+ kasan_slab_free+0x10/0x18 mm/kasan/kasan.c:528
+ slab_free_hook mm/slub.c:1370 [inline]
+ slab_free_freelist_hook mm/slub.c:1397 [inline]
+ slab_free mm/slub.c:2952 [inline]
+ kmem_cache_free+0xb8/0x3a8 mm/slub.c:2968
+ net_free net/core/net_namespace.c:400 [inline]
+ net_drop_ns.part.6+0x78/0x90 net/core/net_namespace.c:407
+ net_drop_ns net/core/net_namespace.c:406 [inline]
+ cleanup_net+0x53c/0x6d8 net/core/net_namespace.c:569
+ process_one_work+0x6e8/0x1700 kernel/workqueue.c:2153
+ worker_thread+0x3b0/0xdd0 kernel/workqueue.c:2296
+ kthread+0x2f0/0x378 kernel/kthread.c:255
+ ret_from_fork+0x10/0x18 arch/arm64/kernel/entry.S:1117
+
+The buggy address belongs to the object at ffff8003496a3f80
+ which belongs to the cache net_namespace of size 7872
+The buggy address is located 1796 bytes inside of
+ 7872-byte region [ffff8003496a3f80, ffff8003496a5e40)
+The buggy address belongs to the page:
+page:ffff7e000d25a800 count:1 mapcount:0 mapping:ffff80036ce4b000
+index:0x0 compound_mapcount: 0
+flags: 0xffffe0000008100(slab|head)
+raw: 0ffffe0000008100 dead000000000100 dead000000000200 ffff80036ce4b000
+raw: 0000000000000000 0000000080040004 00000001ffffffff 0000000000000000
+page dumped because: kasan: bad access detected
+
+Memory state around the buggy address:
+ ffff8003496a4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
+ ffff8003496a4600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
+>ffff8003496a4680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
+                   ^
+ ffff8003496a4700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
+ ffff8003496a4780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
+==================================================================
+
+Fixes: 467fa15356ac("RDS-TCP: Support multiple RDS-TCP listen endpoints, one per netns.")
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Mao Wenan <maowenan@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/rds/tcp.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/rds/tcp.c
++++ b/net/rds/tcp.c
+@@ -346,7 +346,7 @@ static void rds_tcp_kill_sock(struct net
+       list_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) {
+               struct net *c_net = read_pnet(&tc->conn->c_net);
+-              if (net != c_net || !tc->t_sock)
++              if (net != c_net)
+                       continue;
+               list_move_tail(&tc->t_tcp_node, &tmp_list);
+       }
diff --git a/queue-4.4/netns-provide-pure-entropy-for-net_hash_mix.patch b/queue-4.4/netns-provide-pure-entropy-for-net_hash_mix.patch
new file mode 100644 (file)
index 0000000..01fef4d
--- /dev/null
@@ -0,0 +1,79 @@
+From foo@baz Mon Apr 15 07:47:06 CEST 2019
+From: Eric Dumazet <edumazet@google.com>
+Date: Wed, 27 Mar 2019 08:21:30 -0700
+Subject: netns: provide pure entropy for net_hash_mix()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 355b98553789b646ed97ad801a619ff898471b92 ]
+
+net_hash_mix() currently uses kernel address of a struct net,
+and is used in many places that could be used to reveal this
+address to a patient attacker, thus defeating KASLR, for
+the typical case (initial net namespace, &init_net is
+not dynamically allocated)
+
+I believe the original implementation tried to avoid spending
+too many cycles in this function, but security comes first.
+
+Also provide entropy regardless of CONFIG_NET_NS.
+
+Fixes: 0b4419162aa6 ("netns: introduce the net_hash_mix "salt" for hashes")
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reported-by: Amit Klein <aksecurity@gmail.com>
+Reported-by: Benny Pinkas <benny@pinkas.net>
+Cc: Pavel Emelyanov <xemul@openvz.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/net/net_namespace.h |    1 +
+ include/net/netns/hash.h    |   15 ++-------------
+ net/core/net_namespace.c    |    1 +
+ 3 files changed, 4 insertions(+), 13 deletions(-)
+
+--- a/include/net/net_namespace.h
++++ b/include/net/net_namespace.h
+@@ -53,6 +53,7 @@ struct net {
+                                                */
+       spinlock_t              rules_mod_lock;
++      u32                     hash_mix;
+       atomic64_t              cookie_gen;
+       struct list_head        list;           /* list of network namespaces */
+--- a/include/net/netns/hash.h
++++ b/include/net/netns/hash.h
+@@ -1,21 +1,10 @@
+ #ifndef __NET_NS_HASH_H__
+ #define __NET_NS_HASH_H__
+-#include <asm/cache.h>
+-
+-struct net;
++#include <net/net_namespace.h>
+ static inline u32 net_hash_mix(const struct net *net)
+ {
+-#ifdef CONFIG_NET_NS
+-      /*
+-       * shift this right to eliminate bits, that are
+-       * always zeroed
+-       */
+-
+-      return (u32)(((unsigned long)net) >> L1_CACHE_SHIFT);
+-#else
+-      return 0;
+-#endif
++      return net->hash_mix;
+ }
+ #endif
+--- a/net/core/net_namespace.c
++++ b/net/core/net_namespace.c
+@@ -280,6 +280,7 @@ static __net_init int setup_net(struct n
+       atomic_set(&net->count, 1);
+       atomic_set(&net->passive, 1);
++      get_random_bytes(&net->hash_mix, sizeof(u32));
+       net->dev_base_seq = 1;
+       net->user_ns = user_ns;
+       idr_init(&net->netns_ids);
diff --git a/queue-4.4/openvswitch-fix-flow-actions-reallocation.patch b/queue-4.4/openvswitch-fix-flow-actions-reallocation.patch
new file mode 100644 (file)
index 0000000..312c285
--- /dev/null
@@ -0,0 +1,65 @@
+From foo@baz Mon Apr 15 09:48:20 CEST 2019
+From: Andrea Righi <andrea.righi@canonical.com>
+Date: Thu, 28 Mar 2019 07:36:00 +0100
+Subject: openvswitch: fix flow actions reallocation
+
+From: Andrea Righi <andrea.righi@canonical.com>
+
+[ Upstream commit f28cd2af22a0c134e4aa1c64a70f70d815d473fb ]
+
+The flow action buffer can be resized if it's not big enough to contain
+all the requested flow actions. However, this resize doesn't take into
+account the new requested size, the buffer is only increased by a factor
+of 2x. This might be not enough to contain the new data, causing a
+buffer overflow, for example:
+
+[   42.044472] =============================================================================
+[   42.045608] BUG kmalloc-96 (Not tainted): Redzone overwritten
+[   42.046415] -----------------------------------------------------------------------------
+
+[   42.047715] Disabling lock debugging due to kernel taint
+[   42.047716] INFO: 0x8bf2c4a5-0x720c0928. First byte 0x0 instead of 0xcc
+[   42.048677] INFO: Slab 0xbc6d2040 objects=29 used=18 fp=0xdc07dec4 flags=0x2808101
+[   42.049743] INFO: Object 0xd53a3464 @offset=2528 fp=0xccdcdebb
+
+[   42.050747] Redzone 76f1b237: cc cc cc cc cc cc cc cc                          ........
+[   42.051839] Object d53a3464: 6b 6b 6b 6b 6b 6b 6b 6b 0c 00 00 00 6c 00 00 00  kkkkkkkk....l...
+[   42.053015] Object f49a30cc: 6c 00 0c 00 00 00 00 00 00 00 00 03 78 a3 15 f6  l...........x...
+[   42.054203] Object acfe4220: 20 00 02 00 ff ff ff ff 00 00 00 00 00 00 00 00   ...............
+[   42.055370] Object 21024e91: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+[   42.056541] Object 070e04c3: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+[   42.057797] Object 948a777a: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+[   42.059061] Redzone 8bf2c4a5: 00 00 00 00                                      ....
+[   42.060189] Padding a681b46e: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
+
+Fix by making sure the new buffer is properly resized to contain all the
+requested data.
+
+BugLink: https://bugs.launchpad.net/bugs/1813244
+Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
+Acked-by: Pravin B Shelar <pshelar@ovn.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/openvswitch/flow_netlink.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/net/openvswitch/flow_netlink.c
++++ b/net/openvswitch/flow_netlink.c
+@@ -1736,14 +1736,14 @@ static struct nlattr *reserve_sfa_size(s
+       struct sw_flow_actions *acts;
+       int new_acts_size;
+-      int req_size = NLA_ALIGN(attr_len);
++      size_t req_size = NLA_ALIGN(attr_len);
+       int next_offset = offsetof(struct sw_flow_actions, actions) +
+                                       (*sfa)->actions_len;
+       if (req_size <= (ksize(*sfa) - next_offset))
+               goto out;
+-      new_acts_size = ksize(*sfa) * 2;
++      new_acts_size = max(next_offset + req_size, ksize(*sfa) * 2);
+       if (new_acts_size > MAX_ACTIONS_BUFSIZE) {
+               if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) {
diff --git a/queue-4.4/qmi_wwan-add-olicard-600.patch b/queue-4.4/qmi_wwan-add-olicard-600.patch
new file mode 100644 (file)
index 0000000..742576f
--- /dev/null
@@ -0,0 +1,59 @@
+From foo@baz Mon Apr 15 09:48:20 CEST 2019
+From: "Bjørn Mork" <bjorn@mork.no>
+Date: Wed, 27 Mar 2019 15:26:01 +0100
+Subject: qmi_wwan: add Olicard 600
+
+From: "Bjørn Mork" <bjorn@mork.no>
+
+[ Upstream commit 6289d0facd9ebce4cc83e5da39e15643ee998dc5 ]
+
+This is a Qualcomm based device with a QMI function on interface 4.
+It is mode switched from 2020:2030 using a standard eject message.
+
+T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=480  MxCh= 0
+D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
+P:  Vendor=2020 ProdID=2031 Rev= 2.32
+S:  Manufacturer=Mobile Connect
+S:  Product=Mobile Connect
+S:  SerialNumber=0123456789ABCDEF
+C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
+I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
+E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
+E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
+E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
+E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
+E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
+E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
+E:  Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
+
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/usb/qmi_wwan.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -717,6 +717,7 @@ static const struct usb_device_id produc
+       {QMI_FIXED_INTF(0x19d2, 0x2002, 4)},    /* ZTE (Vodafone) K3765-Z */
+       {QMI_FIXED_INTF(0x2001, 0x7e19, 4)},    /* D-Link DWM-221 B1 */
+       {QMI_FIXED_INTF(0x2001, 0x7e35, 4)},    /* D-Link DWM-222 */
++      {QMI_FIXED_INTF(0x2020, 0x2031, 4)},    /* Olicard 600 */
+       {QMI_FIXED_INTF(0x2020, 0x2033, 4)},    /* BroadMobi BM806U */
+       {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)},    /* Sierra Wireless MC7700 */
+       {QMI_FIXED_INTF(0x114f, 0x68a2, 8)},    /* Sierra Wireless MC7750 */
diff --git a/queue-4.4/sctp-initialize-_pad-of-sockaddr_in-before-copying-to-user-memory.patch b/queue-4.4/sctp-initialize-_pad-of-sockaddr_in-before-copying-to-user-memory.patch
new file mode 100644 (file)
index 0000000..df12545
--- /dev/null
@@ -0,0 +1,55 @@
+From foo@baz Mon Apr 15 09:48:20 CEST 2019
+From: Xin Long <lucien.xin@gmail.com>
+Date: Sun, 31 Mar 2019 16:58:15 +0800
+Subject: sctp: initialize _pad of sockaddr_in before copying to user memory
+
+From: Xin Long <lucien.xin@gmail.com>
+
+[ Upstream commit 09279e615c81ce55e04835970601ae286e3facbe ]
+
+Syzbot report a kernel-infoleak:
+
+  BUG: KMSAN: kernel-infoleak in _copy_to_user+0x16b/0x1f0 lib/usercopy.c:32
+  Call Trace:
+    _copy_to_user+0x16b/0x1f0 lib/usercopy.c:32
+    copy_to_user include/linux/uaccess.h:174 [inline]
+    sctp_getsockopt_peer_addrs net/sctp/socket.c:5911 [inline]
+    sctp_getsockopt+0x1668e/0x17f70 net/sctp/socket.c:7562
+    ...
+  Uninit was stored to memory at:
+    sctp_transport_init net/sctp/transport.c:61 [inline]
+    sctp_transport_new+0x16d/0x9a0 net/sctp/transport.c:115
+    sctp_assoc_add_peer+0x532/0x1f70 net/sctp/associola.c:637
+    sctp_process_param net/sctp/sm_make_chunk.c:2548 [inline]
+    sctp_process_init+0x1a1b/0x3ed0 net/sctp/sm_make_chunk.c:2361
+    ...
+  Bytes 8-15 of 16 are uninitialized
+
+It was caused by that th _pad field (the 8-15 bytes) of a v4 addr (saved in
+struct sockaddr_in) wasn't initialized, but directly copied to user memory
+in sctp_getsockopt_peer_addrs().
+
+So fix it by calling memset(addr->v4.sin_zero, 0, 8) to initialize _pad of
+sockaddr_in before copying it to user memory in sctp_v4_addr_to_user(), as
+sctp_v6_addr_to_user() does.
+
+Reported-by: syzbot+86b5c7c236a22616a72f@syzkaller.appspotmail.com
+Signed-off-by: Xin Long <lucien.xin@gmail.com>
+Tested-by: Alexander Potapenko <glider@google.com>
+Acked-by: Neil Horman <nhorman@tuxdriver.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/sctp/protocol.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/net/sctp/protocol.c
++++ b/net/sctp/protocol.c
+@@ -598,6 +598,7 @@ out:
+ static int sctp_v4_addr_to_user(struct sctp_sock *sp, union sctp_addr *addr)
+ {
+       /* No address mapping for V4 sockets */
++      memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero));
+       return sizeof(struct sockaddr_in);
+ }
index 0d0f7d11d40d54295a6d11d0596b631351c9af06..5ea03940a8e693461ce7f6e91f9525d5af17e11d 100644 (file)
@@ -77,3 +77,16 @@ x86-build-specify-elf_i386-linker-emulation-explicit.patch
 x86-vdso-use-ld-instead-of-cc-to-link.patch
 x86-vdso-drop-implicit-common-page-size-linker-flag.patch
 lib-string.c-implement-a-basic-bcmp.patch
+tty-mark-siemens-r3964-line-discipline-as-broken.patch
+tty-ldisc-add-sysctl-to-prevent-autoloading-of-ldiscs.patch
+ipv6-fix-dangling-pointer-when-ipv6-fragment.patch
+ipv6-sit-reset-ip-header-pointer-in-ipip6_rcv.patch
+net-rds-force-to-destroy-connection-if-t_sock-is-null-in-rds_tcp_kill_sock.patch
+openvswitch-fix-flow-actions-reallocation.patch
+qmi_wwan-add-olicard-600.patch
+sctp-initialize-_pad-of-sockaddr_in-before-copying-to-user-memory.patch
+tcp-ensure-dctcp-reacts-to-losses.patch
+netns-provide-pure-entropy-for-net_hash_mix.patch
+net-ethtool-not-call-vzalloc-for-zero-sized-memory-request.patch
+ip6_tunnel-match-to-arphrd_tunnel6-for-dev-type.patch
+alsa-seq-fix-oob-reads-from-strlcpy.patch
diff --git a/queue-4.4/tcp-ensure-dctcp-reacts-to-losses.patch b/queue-4.4/tcp-ensure-dctcp-reacts-to-losses.patch
new file mode 100644 (file)
index 0000000..50f5aa2
--- /dev/null
@@ -0,0 +1,139 @@
+From foo@baz Mon Apr 15 09:48:20 CEST 2019
+From: Koen De Schepper <koen.de_schepper@nokia-bell-labs.com>
+Date: Thu, 4 Apr 2019 12:24:02 +0000
+Subject: tcp: Ensure DCTCP reacts to losses
+
+From: Koen De Schepper <koen.de_schepper@nokia-bell-labs.com>
+
+[ Upstream commit aecfde23108b8e637d9f5c5e523b24fb97035dc3 ]
+
+RFC8257 §3.5 explicitly states that "A DCTCP sender MUST react to
+loss episodes in the same way as conventional TCP".
+
+Currently, Linux DCTCP performs no cwnd reduction when losses
+are encountered. Optionally, the dctcp_clamp_alpha_on_loss resets
+alpha to its maximal value if a RTO happens. This behavior
+is sub-optimal for at least two reasons: i) it ignores losses
+triggering fast retransmissions; and ii) it causes unnecessary large
+cwnd reduction in the future if the loss was isolated as it resets
+the historical term of DCTCP's alpha EWMA to its maximal value (i.e.,
+denoting a total congestion). The second reason has an especially
+noticeable effect when using DCTCP in high BDP environments, where
+alpha normally stays at low values.
+
+This patch replace the clamping of alpha by setting ssthresh to
+half of cwnd for both fast retransmissions and RTOs, at most once
+per RTT. Consequently, the dctcp_clamp_alpha_on_loss module parameter
+has been removed.
+
+The table below shows experimental results where we measured the
+drop probability of a PIE AQM (not applying ECN marks) at a
+bottleneck in the presence of a single TCP flow with either the
+alpha-clamping option enabled or the cwnd halving proposed by this
+patch. Results using reno or cubic are given for comparison.
+
+                          |  Link   |   RTT    |    Drop
+                 TCP CC   |  speed  | base+AQM | probability
+        ==================|=========|==========|============
+                    CUBIC |  40Mbps |  7+20ms  |    0.21%
+                     RENO |         |          |    0.19%
+        DCTCP-CLAMP-ALPHA |         |          |   25.80%
+         DCTCP-HALVE-CWND |         |          |    0.22%
+        ------------------|---------|----------|------------
+                    CUBIC | 100Mbps |  7+20ms  |    0.03%
+                     RENO |         |          |    0.02%
+        DCTCP-CLAMP-ALPHA |         |          |   23.30%
+         DCTCP-HALVE-CWND |         |          |    0.04%
+        ------------------|---------|----------|------------
+                    CUBIC | 800Mbps |   1+1ms  |    0.04%
+                     RENO |         |          |    0.05%
+        DCTCP-CLAMP-ALPHA |         |          |   18.70%
+         DCTCP-HALVE-CWND |         |          |    0.06%
+
+We see that, without halving its cwnd for all source of losses,
+DCTCP drives the AQM to large drop probabilities in order to keep
+the queue length under control (i.e., it repeatedly faces RTOs).
+Instead, if DCTCP reacts to all source of losses, it can then be
+controlled by the AQM using similar drop levels than cubic or reno.
+
+Signed-off-by: Koen De Schepper <koen.de_schepper@nokia-bell-labs.com>
+Signed-off-by: Olivier Tilmans <olivier.tilmans@nokia-bell-labs.com>
+Cc: Bob Briscoe <research@bobbriscoe.net>
+Cc: Lawrence Brakmo <brakmo@fb.com>
+Cc: Florian Westphal <fw@strlen.de>
+Cc: Daniel Borkmann <borkmann@iogearbox.net>
+Cc: Yuchung Cheng <ycheng@google.com>
+Cc: Neal Cardwell <ncardwell@google.com>
+Cc: Eric Dumazet <edumazet@google.com>
+Cc: Andrew Shewmaker <agshew@gmail.com>
+Cc: Glenn Judd <glenn.judd@morganstanley.com>
+Acked-by: Florian Westphal <fw@strlen.de>
+Acked-by: Neal Cardwell <ncardwell@google.com>
+Acked-by: Daniel Borkmann <daniel@iogearbox.net>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv4/tcp_dctcp.c |   36 ++++++++++++++++++------------------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+--- a/net/ipv4/tcp_dctcp.c
++++ b/net/ipv4/tcp_dctcp.c
+@@ -66,11 +66,6 @@ static unsigned int dctcp_alpha_on_init
+ module_param(dctcp_alpha_on_init, uint, 0644);
+ MODULE_PARM_DESC(dctcp_alpha_on_init, "parameter for initial alpha value");
+-static unsigned int dctcp_clamp_alpha_on_loss __read_mostly;
+-module_param(dctcp_clamp_alpha_on_loss, uint, 0644);
+-MODULE_PARM_DESC(dctcp_clamp_alpha_on_loss,
+-               "parameter for clamping alpha on loss");
+-
+ static struct tcp_congestion_ops dctcp_reno;
+ static void dctcp_reset(const struct tcp_sock *tp, struct dctcp *ca)
+@@ -211,21 +206,23 @@ static void dctcp_update_alpha(struct so
+       }
+ }
+-static void dctcp_state(struct sock *sk, u8 new_state)
++static void dctcp_react_to_loss(struct sock *sk)
+ {
+-      if (dctcp_clamp_alpha_on_loss && new_state == TCP_CA_Loss) {
+-              struct dctcp *ca = inet_csk_ca(sk);
++      struct dctcp *ca = inet_csk_ca(sk);
++      struct tcp_sock *tp = tcp_sk(sk);
+-              /* If this extension is enabled, we clamp dctcp_alpha to
+-               * max on packet loss; the motivation is that dctcp_alpha
+-               * is an indicator to the extend of congestion and packet
+-               * loss is an indicator of extreme congestion; setting
+-               * this in practice turned out to be beneficial, and
+-               * effectively assumes total congestion which reduces the
+-               * window by half.
+-               */
+-              ca->dctcp_alpha = DCTCP_MAX_ALPHA;
+-      }
++      ca->loss_cwnd = tp->snd_cwnd;
++      tp->snd_ssthresh = max(tp->snd_cwnd >> 1U, 2U);
++}
++
++static void dctcp_state(struct sock *sk, u8 new_state)
++{
++      if (new_state == TCP_CA_Recovery &&
++          new_state != inet_csk(sk)->icsk_ca_state)
++              dctcp_react_to_loss(sk);
++      /* We handle RTO in dctcp_cwnd_event to ensure that we perform only
++       * one loss-adjustment per RTT.
++       */
+ }
+ static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
+@@ -237,6 +234,9 @@ static void dctcp_cwnd_event(struct sock
+       case CA_EVENT_ECN_NO_CE:
+               dctcp_ce_state_1_to_0(sk);
+               break;
++      case CA_EVENT_LOSS:
++              dctcp_react_to_loss(sk);
++              break;
+       default:
+               /* Don't care for the rest. */
+               break;
diff --git a/queue-4.4/tty-ldisc-add-sysctl-to-prevent-autoloading-of-ldiscs.patch b/queue-4.4/tty-ldisc-add-sysctl-to-prevent-autoloading-of-ldiscs.patch
new file mode 100644 (file)
index 0000000..627fd60
--- /dev/null
@@ -0,0 +1,143 @@
+From 7c0cca7c847e6e019d67b7d793efbbe3b947d004 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Mon, 21 Jan 2019 17:26:42 +0100
+Subject: tty: ldisc: add sysctl to prevent autoloading of ldiscs
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+commit 7c0cca7c847e6e019d67b7d793efbbe3b947d004 upstream.
+
+By default, the kernel will automatically load the module of any line
+dicipline that is asked for.  As this sometimes isn't the safest thing
+to do, provide a sysctl to disable this feature.
+
+By default, we set this to 'y' as that is the historical way that Linux
+has worked, and we do not want to break working systems.  But in the
+future, perhaps this can default to 'n' to prevent this functionality.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Reviewed-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/Kconfig     |   23 +++++++++++++++++++++++
+ drivers/tty/tty_io.c    |    3 +++
+ drivers/tty/tty_ldisc.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 73 insertions(+)
+
+--- a/drivers/tty/Kconfig
++++ b/drivers/tty/Kconfig
+@@ -466,4 +466,27 @@ config MIPS_EJTAG_FDC_KGDB_CHAN
+       help
+         FDC channel number to use for KGDB.
++config LDISC_AUTOLOAD
++      bool "Automatically load TTY Line Disciplines"
++      default y
++      help
++        Historically the kernel has always automatically loaded any
++        line discipline that is in a kernel module when a user asks
++        for it to be loaded with the TIOCSETD ioctl, or through other
++        means.  This is not always the best thing to do on systems
++        where you know you will not be using some of the more
++        "ancient" line disciplines, so prevent the kernel from doing
++        this unless the request is coming from a process with the
++        CAP_SYS_MODULE permissions.
++
++        Say 'Y' here if you trust your userspace users to do the right
++        thing, or if you have only provided the line disciplines that
++        you know you will be using, or if you wish to continue to use
++        the traditional method of on-demand loading of these modules
++        by any user.
++
++        This functionality can be changed at runtime with the
++        dev.tty.ldisc_autoload sysctl, this configuration option will
++        only set the default value of this functionality.
++
+ endif # TTY
+--- a/drivers/tty/tty_io.c
++++ b/drivers/tty/tty_io.c
+@@ -513,6 +513,8 @@ void proc_clear_tty(struct task_struct *
+       tty_kref_put(tty);
+ }
++extern void tty_sysctl_init(void);
++
+ /**
+  * proc_set_tty -  set the controlling terminal
+  *
+@@ -3689,6 +3691,7 @@ void console_sysfs_notify(void)
+  */
+ int __init tty_init(void)
+ {
++      tty_sysctl_init();
+       cdev_init(&tty_cdev, &tty_fops);
+       if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
+           register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
+--- a/drivers/tty/tty_ldisc.c
++++ b/drivers/tty/tty_ldisc.c
+@@ -148,6 +148,13 @@ static void put_ldops(struct tty_ldisc_o
+  *            takes tty_ldiscs_lock to guard against ldisc races
+  */
++#if defined(CONFIG_LDISC_AUTOLOAD)
++      #define INITIAL_AUTOLOAD_STATE  1
++#else
++      #define INITIAL_AUTOLOAD_STATE  0
++#endif
++static int tty_ldisc_autoload = INITIAL_AUTOLOAD_STATE;
++
+ static struct tty_ldisc *tty_ldisc_get(struct tty_struct *tty, int disc)
+ {
+       struct tty_ldisc *ld;
+@@ -162,6 +169,8 @@ static struct tty_ldisc *tty_ldisc_get(s
+        */
+       ldops = get_ldops(disc);
+       if (IS_ERR(ldops)) {
++              if (!capable(CAP_SYS_MODULE) && !tty_ldisc_autoload)
++                      return ERR_PTR(-EPERM);
+               request_module("tty-ldisc-%d", disc);
+               ldops = get_ldops(disc);
+               if (IS_ERR(ldops))
+@@ -830,3 +839,41 @@ void tty_ldisc_begin(void)
+       /* Setup the default TTY line discipline. */
+       (void) tty_register_ldisc(N_TTY, &tty_ldisc_N_TTY);
+ }
++
++static int zero;
++static int one = 1;
++static struct ctl_table tty_table[] = {
++      {
++              .procname       = "ldisc_autoload",
++              .data           = &tty_ldisc_autoload,
++              .maxlen         = sizeof(tty_ldisc_autoload),
++              .mode           = 0644,
++              .proc_handler   = proc_dointvec,
++              .extra1         = &zero,
++              .extra2         = &one,
++      },
++      { }
++};
++
++static struct ctl_table tty_dir_table[] = {
++      {
++              .procname       = "tty",
++              .mode           = 0555,
++              .child          = tty_table,
++      },
++      { }
++};
++
++static struct ctl_table tty_root_table[] = {
++      {
++              .procname       = "dev",
++              .mode           = 0555,
++              .child          = tty_dir_table,
++      },
++      { }
++};
++
++void tty_sysctl_init(void)
++{
++      register_sysctl_table(tty_root_table);
++}
diff --git a/queue-4.4/tty-mark-siemens-r3964-line-discipline-as-broken.patch b/queue-4.4/tty-mark-siemens-r3964-line-discipline-as-broken.patch
new file mode 100644 (file)
index 0000000..90b1ad7
--- /dev/null
@@ -0,0 +1,45 @@
+From c7084edc3f6d67750f50d4183134c4fb5712a5c8 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Fri, 5 Apr 2019 15:39:26 +0200
+Subject: tty: mark Siemens R3964 line discipline as BROKEN
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+commit c7084edc3f6d67750f50d4183134c4fb5712a5c8 upstream.
+
+The n_r3964 line discipline driver was written in a different time, when
+SMP machines were rare, and users were trusted to do the right thing.
+Since then, the world has moved on but not this code, it has stayed
+rooted in the past with its lovely hand-crafted list structures and
+loads of "interesting" race conditions all over the place.
+
+After attempting to clean up most of the issues, I just gave up and am
+now marking the driver as BROKEN so that hopefully someone who has this
+hardware will show up out of the woodwork (I know you are out there!)
+and will help with debugging a raft of changes that I had laying around
+for the code, but was too afraid to commit as odds are they would break
+things.
+
+Many thanks to Jann and Linus for pointing out the initial problems in
+this codebase, as well as many reviews of my attempts to fix the issues.
+It was a case of whack-a-mole, and as you can see, the mole won.
+
+Reported-by: Jann Horn <jannh@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+
+---
+ drivers/char/Kconfig |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/char/Kconfig
++++ b/drivers/char/Kconfig
+@@ -389,7 +389,7 @@ config XILINX_HWICAP
+ config R3964
+       tristate "Siemens R3964 line discipline"
+-      depends on TTY
++      depends on TTY && BROKEN
+       ---help---
+         This driver allows synchronous communication with devices using the
+         Siemens R3964 packet protocol. Unless you are dealing with special