From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Dave Taht <dave.taht@gmail.com>
Cc: Daniel Borkmann <dborkman@redhat.com>,
davem@davemloft.net, netdev@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
Thomas Graf <tgraf@suug.ch>
Subject: Re: [PATCH net] netlink: use jhash as hashfn for rhashtable
Date: Mon, 08 Dec 2014 18:25:39 +0100 [thread overview]
Message-ID: <1418059539.290986.200302913.180EA222@webmail.messagingengine.com> (raw)
In-Reply-To: <CAA93jw5bAqxbpxyOHEHd6XSEn4-HK0a9qw3Cb_Vecb8Nz=xbfg@mail.gmail.com>
On Mon, Dec 8, 2014, at 18:20, Dave Taht wrote:
> On Mon, Dec 8, 2014 at 8:56 AM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
> > On Mo, 2014-12-08 at 17:30 +0100, Daniel Borkmann wrote:
> >> For netlink, we shouldn't be using arch_fast_hash() as a hashing
> >> discipline, but rather jhash() instead.
>
> I am not particularly happy with the amount of entropy in
>
> static inline u32 ipv6_addr_hash(const struct in6_addr *a)
> {
> #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG ==
> 64
> const unsigned long *ul = (const unsigned long *)a;
> unsigned long x = ul[0] ^ ul[1];
>
> return (u32)(x ^ (x >> 32));
> #else
> return (__force u32)(a->s6_addr32[0] ^ a->s6_addr32[1] ^
> a->s6_addr32[2] ^ a->s6_addr32[3]);
> #endif
> }
>
> is this worth improving somehow?
>
That's e.g. the reason why we have
commit 5a3da1fe9561828d0ca7eca664b16ec2b9bf0055
Author: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Fri Mar 15 11:32:30 2013 +0000
inet: limit length of fragment queue hash table bucket lists
Note, __ipv6_addr_jhash (xoring the upper 32 bit before jhashing them)
has the same problem. I currently cannot spot any problematic users in
the kernel, flow dissector hashes are insecure by nature, local
addresses normally don't have problems with hash collisions. But maybe I
should redo an audit. :)
Bye,
Hannes
next prev parent reply other threads:[~2014-12-08 17:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-08 16:30 [PATCH net] netlink: use jhash as hashfn for rhashtable Daniel Borkmann
2014-12-08 16:38 ` Thomas Graf
2014-12-08 16:56 ` Hannes Frederic Sowa
2014-12-08 17:20 ` Dave Taht
2014-12-08 17:25 ` Hannes Frederic Sowa [this message]
2014-12-09 19:38 ` David Miller
2014-12-09 22:56 ` Daniel Borkmann
2014-12-09 23:09 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418059539.290986.200302913.180EA222@webmail.messagingengine.com \
--to=hannes@stressinduktion.org \
--cc=dave.taht@gmail.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).