[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJKu_ZnkP0WjDXmFQpBKK=LRPvsoPiHiv8hkmoq123K0w@mail.gmail.com>
Date: Tue, 8 Oct 2024 13:21:08 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Kuniyuki Iwashima <kuniyu@...zon.com>, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, David Ahern <dsahern@...nel.org>,
Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next 4/4] ipv4: Retire global IPv4 hash table inet_addr_lst.
On Tue, Oct 8, 2024 at 1:10 PM Paolo Abeni <pabeni@...hat.com> wrote:
>
> On 10/4/24 21:59, Kuniyuki Iwashima wrote:
> > No one uses inet_addr_lst anymore, so let's remove it.
> >
> > While at it, we can remove net_hash_mix() from the hash calculation.
>
> Is that really safe? it will make hash collision predictable in a
> deterministic way.
>
> FTR, IPv6 still uses the net seed.
I was planning to switch ipv6 to a safer hash, because the
ipv6_addr_hash() is also predictable.
It is easy for an attacker to push 10000 ipv6 addresses on the same slot.
We have netns isolation for sure, but being able to use a big amount
of cpu cycles in the kernel is an issue.
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 94dceac528842c47c18e71ad75e9d16ae373b4f2..f31528d4f694e42032276ddd6230b23911c480b5
100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1016,7 +1016,7 @@ ipv6_link_dev_addr(struct inet6_dev *idev,
struct inet6_ifaddr *ifp)
static u32 inet6_addr_hash(const struct net *net, const struct in6_addr *addr)
{
- u32 val = ipv6_addr_hash(addr) ^ net_hash_mix(net);
+ u32 val = __ipv6_addr_jhash(addr, net_hash_mix(net));
return hash_32(val, IN6_ADDR_HSIZE_SHIFT);
}
Powered by blists - more mailing lists