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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140304.134141.1732220919806520941.davem@davemloft.net>
Date:	Tue, 04 Mar 2014 13:41:41 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	anton@...ba.org
Cc:	edumazet@...gle.com, gustavold@...ux.vnet.ibm.com,
	netdev@...r.kernel.org
Subject: Re: [PATCH] net: unix socket code abuses csum_partial

From: Anton Blanchard <anton@...ba.org>
Date: Tue, 4 Mar 2014 21:01:04 +1100

> The unix socket code is using the result of csum_partial to
> hash into a lookup table:
> 
> 	unix_hash_fold(csum_partial(sunaddr, len, 0));
> 
> csum_partial is only guaranteed to produce something that can be
> folded into a checksum, as its prototype explains:
> 
>  * returns a 32-bit number suitable for feeding into itself
>  * or csum_tcpudp_magic
> 
> The 32bit value should not be used directly.
> 
> Depending on the alignment the ppc64 csum_partial will return
> different 32bit values that will fold into the same checksum.
> 
> This difference causes the following testcase (courtesy of
> Gustavo) to sometimes fail:

Alternatively you could just make unix_hash_fold() use csum_fold(),
right?

static inline unsigned int unix_hash_fold(__wsum n)
{
	unsigned int hash = (__force unsigned int) csum_fold(n);

	hash ^= hash>>8;
	return hash&(UNIX_HASH_SIZE-1);
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ