This is a note to let you know that I've just added the patch titled ipv4: use siphash instead of Jenkins in fnhe_hashfun() to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ipv4-use-siphash-instead-of-jenkins-in-fnhe_hashfun.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Fri Oct 29 05:02:10 PM CEST 2021 From: Ovidiu Panait <ovidiu.panait@xxxxxxxxxxxxx> Date: Fri, 29 Oct 2021 10:50:25 +0300 Subject: ipv4: use siphash instead of Jenkins in fnhe_hashfun() To: stable@xxxxxxxxxxxxxxx Cc: gregkh@xxxxxxxxxxxxxxxxxxx Message-ID: <20211029075027.1910142-2-ovidiu.panait@xxxxxxxxxxxxx> From: Eric Dumazet <edumazet@xxxxxxxxxx> commit 6457378fe796815c973f631a1904e147d6ee33b1 upstream. A group of security researchers brought to our attention the weakness of hash function used in fnhe_hashfun(). Lets use siphash instead of Jenkins Hash, to considerably reduce security risks. Also remove the inline keyword, this really is distracting. Fixes: d546c621542d ("ipv4: harden fnhe_hashfun()") Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx> Reported-by: Keyu Man <kman001@xxxxxxx> Cc: Willy Tarreau <w@xxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> [OP: adjusted context for 4.19 stable] Signed-off-by: Ovidiu Panait <ovidiu.panait@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/ipv4/route.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -625,14 +625,14 @@ static void fnhe_remove_oldest(struct fn kfree_rcu(oldest, rcu); } -static inline u32 fnhe_hashfun(__be32 daddr) +static u32 fnhe_hashfun(__be32 daddr) { - static u32 fnhe_hashrnd __read_mostly; - u32 hval; + static siphash_key_t fnhe_hash_key __read_mostly; + u64 hval; - net_get_random_once(&fnhe_hashrnd, sizeof(fnhe_hashrnd)); - hval = jhash_1word((__force u32) daddr, fnhe_hashrnd); - return hash_32(hval, FNHE_HASH_SHIFT); + net_get_random_once(&fnhe_hash_key, sizeof(fnhe_hash_key)); + hval = siphash_1u32((__force u32)daddr, &fnhe_hash_key); + return hash_64(hval, FNHE_HASH_SHIFT); } static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) Patches currently in stable-queue which might be from ovidiu.panait@xxxxxxxxxxxxx are queue-4.19/ipv6-use-siphash-in-rt6_exception_hash.patch queue-4.19/ipv6-make-exception-cache-less-predictible.patch queue-4.19/ipv4-use-siphash-instead-of-jenkins-in-fnhe_hashfun.patch