From: Daniel Borkmann <dborkman@redhat.com>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Thomas Graf <tgraf@suug.ch>,
"David S. Miller" <davem@davemloft.net>,
"Theodore Ts'o" <tytso@mit.edu>,
netdev@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
fusco@ntop.org
Subject: Re: Where exactly will arch_fast_hash be used
Date: Thu, 04 Dec 2014 14:14:24 +0100 [thread overview]
Message-ID: <54805E30.4090109@redhat.com> (raw)
In-Reply-To: <1417696468.5386.23.camel@localhost>
On 12/04/2014 01:34 PM, Hannes Frederic Sowa wrote:
> On Do, 2014-12-04 at 16:11 +0800, Herbert Xu wrote:
>> While working on rhashtable it came to me that this whole concept
>> of arch_fast_hash is flawed. CRCs are linear functions so it's
>> fairly easy for an attacker to identify collisions or at least
>> eliminate a large amount of search space (e.g., controlling the
>> last bit of the hash result is almost trivial, even when you add
>> a random seed).
>>
>> So what exactly are we going to use arch_fast_hash for? Presumably
>> it's places where security is never goint to be an issue, right?
The original proposal [1] targeted ovs-only as a closed-door user in
order to speed up the worst case of calculating a hash over the extracted
flow key, that is, struct sw_flow_key (which nowadays consumes up to
7 cachelines on x86_64 ...).
[1] http://thread.gmane.org/gmane.linux.network/293981/
>> Even if security wasn't an issue, straight CRC32 has really poor
>> lower-order bit distribution, which makes it a terrible choice for
>> a hash table that simply uses the lower-order bits.
>
> I wondered the same while trying to use arch_fast_hash in a lot more
> places (I did a new implementation in assembler I'll send later on, it
> is mostly optimized to deal with ovs flow keys).
>
> While the uniformity of crc32 does actually look good and IMHO this even
> holds for the lower bits of the hash, I totally agree on the linearity
> matters.
>
> The easiest way to make arch_fast_hash non-linear would be to build up
> on the crc32 instruction like e.g. the cityhash function family does and
> it seems not too hard to do that by combining two crc32c outputs of the
> original and cyclic shifted input data. I have doubts if this is faster
> than jhash in the end. There are proposals from Intel to do so, but they
> are patent encumbered. :/
>
> For most consumers in the networking stack, security and DoS resistence
> is an issue. OVS, for which this was designed at first does do rehashing
> from time to time, but still there is a possible DoS attack vector with
> this hashing algorithm.
next prev parent reply other threads:[~2014-12-04 13:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-04 8:11 Where exactly will arch_fast_hash be used Herbert Xu
2014-12-04 12:34 ` Hannes Frederic Sowa
2014-12-04 13:14 ` Daniel Borkmann [this message]
2014-12-04 15:26 ` Thomas Graf
2014-12-04 15:29 ` Herbert Xu
2014-12-04 15:39 ` Thomas Graf
2014-12-04 15:43 ` Daniel Borkmann
2014-12-04 15:47 ` Herbert Xu
2014-12-04 15:51 ` Daniel Borkmann
2014-12-04 15:56 ` David Laight
2014-12-04 16:10 ` Herbert Xu
-- strict thread matches above, loose matches on Subject: below --
2014-12-07 5:20 George Spelvin
2014-12-07 9:28 ` Herbert Xu
2014-12-07 10:02 ` George Spelvin
2014-12-07 12:51 ` Herbert Xu
2014-12-07 13:23 ` George Spelvin
2014-12-07 14:06 ` Hannes Frederic Sowa
2014-12-07 21:33 ` George Spelvin
2014-12-08 11:25 ` Hannes Frederic Sowa
2014-12-08 16:19 ` George Spelvin
2014-12-08 16:32 ` Hannes Frederic Sowa
2014-12-09 14:24 ` Herbert Xu
2014-12-07 13:14 ` Hannes Frederic Sowa
2014-12-07 13:30 ` George Spelvin
2014-12-07 13:41 ` Hannes Frederic Sowa
2014-12-07 13:52 ` Hannes Frederic Sowa
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=54805E30.4090109@redhat.com \
--to=dborkman@redhat.com \
--cc=davem@davemloft.net \
--cc=fusco@ntop.org \
--cc=hannes@stressinduktion.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tgraf@suug.ch \
--cc=tytso@mit.edu \
/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).