[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85cbe227-5eb8-bc32-7707-fe5e76aa7476@gmail.com>
Date: Sun, 29 Aug 2021 17:40:11 -0700
From: David Ahern <dsahern@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>, Willy Tarreau <w@....eu>,
Keyu Man <kman001@....edu>, David Ahern <dsahern@...nel.org>
Subject: Re: [PATCH net 2/2] ipv4: make exception cache less predictible
On 8/29/21 3:16 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> Even after commit 6457378fe796 ("ipv4: use siphash instead of Jenkins in
> fnhe_hashfun()"), an attacker can still use brute force to learn
> some secrets from a victim linux host.
>
> One way to defeat these attacks is to make the max depth of the hash
> table bucket a random value.
>
> Before this patch, each bucket of the hash table used to store exceptions
> could contain 6 items under attack.
>
> After the patch, each bucket would contains a random number of items,
> between 6 and 10. The attacker can no longer infer secrets.
>
> This is slightly increasing memory size used by the hash table,
> by 50% in average, we do not expect this to be a problem.
>
> This patch is more complex than the prior one (IPv6 equivalent),
> because IPv4 was reusing the oldest entry.
> Since we need to be able to evict more than one entry per
> update_or_create_fnhe() call, I had to replace
> fnhe_oldest() with fnhe_remove_oldest().
>
> Also note that we will queue extra kfree_rcu() calls under stress,
> which hopefully wont be a too big issue.
>
> Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Reported-by: Keyu Man <kman001@....edu>
> Cc: Willy Tarreau <w@....eu>
> Signed-off-by: David S. Miller <davem@...emloft.net>
> ---
> net/ipv4/route.c | 44 +++++++++++++++++++++++++++++---------------
> 1 file changed, 29 insertions(+), 15 deletions(-)
>
Reviewed-by: David Ahern <dsahern@...nel.org>
Tested-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists