]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
inet: frags: break the 2GB limit for frags storage
authorEric Dumazet <edumazet@google.com>
Thu, 13 Sep 2018 14:58:45 +0000 (07:58 -0700)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:48:02 +0000 (19:48 -0600)
commitc88be42eeb54e4a647a8f17caebd83062e2961bc
treec713241410b21e4c6e429c287a63e314e37c8c57
parent79583fc1609e82a1bf6cf2ea1550e32079e62e11
inet: frags: break the 2GB limit for frags storage

BugLink: https://bugs.launchpad.net/bugs/1836117
Some users are willing to provision huge amounts of memory to be able
to perform reassembly reasonnably well under pressure.

Current memory tracking is using one atomic_t and integers.

Switch to atomic_long_t so that 64bit arches can use more than 2GB,
without any cost for 32bit arches.

Note that this patch avoids an overflow error, if high_thresh was set
to ~2GB, since this test in inet_frag_alloc() was never true :

if (... || frag_mem_limit(nf) > nf->high_thresh)

Tested:

$ echo 16000000000 >/proc/sys/net/ipv4/ipfrag_high_thresh

<frag DDOS>

$ grep FRAG /proc/net/sockstat
FRAG: inuse 14705885 memory 16000002880

$ nstat -n ; sleep 1 ; nstat | grep Reas
IpReasmReqds                    3317150            0.0
IpReasmFails                    3317112            0.0

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3e67f106f619dcfaf6f4e2039599bdb69848c714)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Documentation/networking/ip-sysctl.txt
include/net/inet_frag.h
net/ieee802154/6lowpan/reassembly.c
net/ipv4/ip_fragment.c
net/ipv4/proc.c
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/proc.c
net/ipv6/reassembly.c