[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210708174632.g5ctdhf4zgpqcpbh@kafai-mbp.dhcp.thefacebook.com>
Date: Thu, 8 Jul 2021 10:46:32 -0700
From: Martin KaFai Lau <kafai@...com>
To: Eric Dumazet <eric.dumazet@...il.com>
CC: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
Maciej Żenczykowski <maze@...gle.com>
Subject: Re: [PATCH v3 net] ipv6: tcp: drop silly ICMPv6 packet too big
messages
On Thu, Jul 08, 2021 at 12:21:09AM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> While TCP stack scales reasonably well, there is still one part that
> can be used to DDOS it.
>
> IPv6 Packet too big messages have to lookup/insert a new route,
> and if abused by attackers, can easily put hosts under high stress,
> with many cpus contending on a spinlock while one is stuck in fib6_run_gc()
>
> ip6_protocol_deliver_rcu()
> icmpv6_rcv()
> icmpv6_notify()
> tcp_v6_err()
> tcp_v6_mtu_reduced()
> inet6_csk_update_pmtu()
> ip6_rt_update_pmtu()
> __ip6_rt_update_pmtu()
> ip6_rt_cache_alloc()
> ip6_dst_alloc()
> dst_alloc()
> ip6_dst_gc()
> fib6_run_gc()
> spin_lock_bh() ...
>
> Some of our servers have been hit by malicious ICMPv6 packets
> trying to _increase_ the MTU/MSS of TCP flows.
>
> We believe these ICMPv6 packets are a result of a bug in one ISP stack,
> since they were blindly sent back for _every_ (small) packet sent to them.
>
> These packets are for one TCP flow:
> 09:24:36.266491 IP6 Addr1 > Victim ICMP6, packet too big, mtu 1460, length 1240
> 09:24:36.266509 IP6 Addr1 > Victim ICMP6, packet too big, mtu 1460, length 1240
> 09:24:36.316688 IP6 Addr1 > Victim ICMP6, packet too big, mtu 1460, length 1240
> 09:24:36.316704 IP6 Addr1 > Victim ICMP6, packet too big, mtu 1460, length 1240
> 09:24:36.608151 IP6 Addr1 > Victim ICMP6, packet too big, mtu 1460, length 1240
>
> TCP stack can filter some silly requests :
>
> 1) MTU below IPV6_MIN_MTU can be filtered early in tcp_v6_err()
> 2) tcp_v6_mtu_reduced() can drop requests trying to increase current MSS.
>
> This tests happen before the IPv6 routing stack is entered, thus
> removing the potential contention and route exhaustion.
>
> Note that IPv6 stack was performing these checks, but too late
> (ie : after the route has been added, and after the potential
> garbage collect war)
>
> v2: fix typo caught by Martin, thanks !
> v3: exports tcp_mtu_to_mss(), caught by David, thanks !
Acked-by: Martin KaFai Lau <kafai@...com>
Powered by blists - more mailing lists