lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1465745571.7945.76.camel@edumazet-glaptop3.roam.corp.google.com>
Date:	Sun, 12 Jun 2016 08:32:51 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Su Xuemin <suxm@...nanetcenter.com>
Cc:	"David S. Miller" <davem@...emloft.net>,
	Alexey Kuznetsov <kuznet@....inr.ac.ru>,
	James Morris <jmorris@...ei.org>,
	Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
	Patrick McHardy <kaber@...sh.net>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH v3] udp reuseport: fix packet of same flow hashed to
 different socket

On Sun, 2016-06-12 at 20:43 +0800, Su Xuemin wrote:
> From: "Su, Xuemin" <suxm@...nanetcenter.com>
...

> Signed-off-by: Su, Xuemin <suxm@...nanetcenter.com>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> ---

First, I want to thank you for this very high quality submission,
especially if this is your first linux kernel patch.

I have one additional comment to make :



>  		if (score > badness) {
>  			reuseport = sk->sk_reuseport;
> @@ -556,14 +510,20 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
>  					  daddr, hnum, dif,
>  					  hslot2, slot2, skb);
>  		if (!result) {
> +			unsigned int old = hash2;
>  			hash2 = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum);
> +
> +			/* avoid search the same slot again. */
> +			if (unlikely(old == hash2))
> +				return result;
> +

Technically speaking, what matters is the slot, not the hash value
(32bit)

So I would save in old, slot2

>  			slot2 = hash2 & udptable->mask;

And here perform the check
			if (unlikely(slot2 != old_slot))
				return result;

>  			hslot2 = &udptable->hash2[slot2];
>  			if (hslot->count < hslot2->count)
>  				goto begin;


(Same remark applies in IPv6)

Thanks !


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ