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]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB02288@AcuExch.aculab.com>
Date:	Tue, 17 Mar 2015 09:56:03 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Eric Dumazet' <eric.dumazet@...il.com>
CC:	'Ben Hutchings' <ben@...adent.org.uk>,
	Stephen Hemminger <shemming@...cade.com>,
	netdev <netdev@...r.kernel.org>
Subject: RE: [PATCH iproute2] ss: better 32bit support

From: Eric 
> On Mon, 2015-03-16 at 16:39 +0000, David Laight wrote:
> 
> > I wondered if the code should be reading the value in the host's natural
> > endianness?
> > Then the code might be optimisable to:
> > 	return *(unsigned long long *)cookie;
> 
> This will trap on arches requesting 8 bytes alignment.

That is why I wrote 'might be optimisable to' :-)

If the 'cookie' were always processed 'host endian' then it
could be accessed using a structure that contains a 64bit member
that has the __aligned(4) attribute.
On x86 (etc) this would generate a 64bit access, on sparc (etc) the compiler
would generate the required shifts.

> Look at rta_getattr_u64(), and you'll see that manipulating 64bit values
> in netlink requires a memcpy() because we have no 64bit alignment
> guarantee.

Using memcpy() isn't necessarily enough.
If you have a 'u64 *' pointer you can't get gcc to 'forget' that it
must have 8 byte alignment, so it will optimise the memcpy back to
a 64bit word copy.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ