Netdev List
 help / color / mirror / Atom feed
* arp_hash
@ 2015-03-22 11:42 Herbert Xu
  2015-03-22 12:56 ` arp_hash Eric Dumazet
  2015-03-22 16:54 ` arp_hash David Miller
  0 siblings, 2 replies; 19+ messages in thread
From: Herbert Xu @ 2015-03-22 11:42 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: Roland Dreier

Hi Dave:

While googling I found the 2011 discussion on changing the arp_hash
function.  I must say that I'm not really impressed by the new
function that replaced jhash :)

	u32 key = *(const u32 *)pkey;
	u32 val = key ^ hash32_ptr(dev);

	return val * hash_rnd[0];

Here pkey is the IP address (controllable by the attacker).  It
gets xored with the device pointer hash, which on x86-64 looks
like (0xffffffff ^ ptr) where ptr is a 32-bit value.  As ptr
must be aligned to at least 8 bytes (I think 16 is probably required
but I haven't checked), that means the bottom three bits of ptr
are 000 and hence the bottom three bits of hash32_ptr(dev) are
always 111.

So the attacker just has to use only addresses with the bottom
3 bits set to 111 and voila, the bottom three bits of val are
always 000.  So you've just cut down your search space by a factor
of 8.  If my assumption above of the 16-byte alignment is correct
then you can cut it down by a factor of 16.

If the attacker can somehow get the pointer value of the device
then all is lost since they could set any number of the low bits
of val to zero.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-03-23 11:01 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-22 11:42 arp_hash Herbert Xu
2015-03-22 12:56 ` arp_hash Eric Dumazet
2015-03-22 16:57   ` arp_hash David Miller
2015-03-22 21:21   ` arp_hash Herbert Xu
2015-03-22 21:56   ` arp_hash Herbert Xu
2015-03-22 22:51     ` arp_hash Herbert Xu
2015-03-22 23:22       ` arp_hash Herbert Xu
2015-03-22 23:35         ` arp_hash Herbert Xu
2015-03-23 10:58           ` arp_hash Herbert Xu
2015-03-22 22:58     ` arp_hash David Miller
2015-03-22 23:08       ` arp_hash Herbert Xu
2015-03-22 23:50         ` arp_hash David Miller
2015-03-22 23:53           ` arp_hash Herbert Xu
2015-03-22 16:54 ` arp_hash David Miller
2015-03-22 21:34   ` arp_hash Herbert Xu
2015-03-22 22:57     ` arp_hash David Miller
2015-03-22 23:42       ` arp_hash Herbert Xu
2015-03-22 23:53         ` arp_hash David Miller
2015-03-23 11:01           ` arp_hash Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox