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]
Date:	Sun, 21 Feb 2016 21:53:46 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	nhorman@...driver.com
Cc:	linux-sctp@...r.kernel.org, netdev@...r.kernel.org,
	dvyukov@...gle.com, vyasevich@...il.com
Subject: Re: [PATCHv2] sctp: Fix port hash table size computation

From: Neil Horman <nhorman@...driver.com>
Date: Thu, 18 Feb 2016 16:10:57 -0500

> Dmitry Vyukov noted recently that the sctp_port_hashtable had an error in
> its size computation, observing that the current method never guaranteed
> that the hashsize (measured in number of entries) would be a power of two,
> which the input hash function for that table requires.  The root cause of
> the problem is that two values need to be computed (one, the allocation
> order of the storage requries, as passed to __get_free_pages, and two the
> number of entries for the hash table).  Both need to be ^2, but for
> different reasons, and the existing code is simply computing one order
> value, and using it as the basis for both, which is wrong (i.e. it assumes
> that ((1<<order)*PAGE_SIZE)/sizeof(bucket) is still ^2 when its not).
> 
> To fix this, we change the logic slightly.  We start by computing a goal
> allocation order (which is limited by the maximum size hash table we want
> to support.  Then we attempt to allocate that size table, decreasing the
> order until a successful allocation is made.  Then, with the resultant
> successful order we compute the number of buckets that hash table supports,
> which we then round down to the nearest power of two, giving us the number
> of entries the table actually supports.
> 
> I've tested this locally here, using non-debug and spinlock-debug kernels,
> and the number of entries in the hashtable consistently work out to be
> powers of two in all cases.
> 
> Signed-off-by: Neil Horman <nhorman@...driver.com>
> Reported-by: Dmitry Vyukov <dvyukov@...gle.com>

Applied and queued up for -stable, thanks Neil.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ