]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tcp: add some entropy in __inet_hash_connect()
authorEric Dumazet <edumazet@google.com>
Tue, 9 Feb 2021 19:20:28 +0000 (11:20 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 09:45:19 +0000 (11:45 +0200)
commit05a12e5c40635bb8b56fbb344f8fd6cbf97e748a
tree99863b401138e58546712de49d0ea450ae2d5330
parent136b4799419a275155c74e8a637cefd8a0538321
tcp: add some entropy in __inet_hash_connect()

commit c579bd1b4021c42ae247108f1e6f73dd3f08600c upstream.

Even when implementing RFC 6056 3.3.4 (Algorithm 4: Double-Hash
Port Selection Algorithm), a patient attacker could still be able
to collect enough state from an otherwise idle host.

Idea of this patch is to inject some noise, in the
cases __inet_hash_connect() found a candidate in the first
attempt.

This noise should not significantly reduce the collision
avoidance, and should be zero if connection table
is already well used.

Note that this is not implementing RFC 6056 3.3.5
because we think Algorithm 5 could hurt typical
workloads.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: David Dworken <ddworken@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/inet_hashtables.c