]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
inet: use bigger hash table for IP ID generation
authorEric Dumazet <edumazet@google.com>
Wed, 24 Mar 2021 21:53:37 +0000 (14:53 -0700)
committerSasha Levin <sashal@kernel.org>
Wed, 30 Jun 2021 12:49:36 +0000 (08:49 -0400)
commit8fb8c138b5d69128964e54e1b5ee49fc395f011c
tree106f6d035df66b1827c1b4e6a83205e65dc0cfe4
parent749af556011acce91beb72e0f6d74539f57ce219
inet: use bigger hash table for IP ID generation

commit aa6dd211e4b1dde9d5dc25d699d35f789ae7eeba upstream.

In commit 73f156a6e8c1 ("inetpeer: get rid of ip_id_count")
I used a very small hash table that could be abused
by patient attackers to reveal sensitive information.

Switch to a dynamic sizing, depending on RAM size.

Typical big hosts will now use 128x more storage (2 MB)
to get a similar increase in security and reduction
of hash collisions.

As a bonus, use of alloc_large_system_hash() spreads
allocated memory among all NUMA nodes.

Fixes: 73f156a6e8c1 ("inetpeer: get rid of ip_id_count")
Reported-by: Amit Klein <aksecurity@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/route.c