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: <063D6719AE5E284EB5DD2968C1650D6D0F6B77F1@AcuExch.aculab.com>
Date:	Mon, 3 Feb 2014 11:54:59 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'James Hogan' <james.hogan@...tec.com>
CC:	'Dan Carpenter' <dan.carpenter@...cle.com>,
	Chen Gang <gang.chen.5i5j@...il.com>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"andreas.dilger@...el.com" <andreas.dilger@...el.com>,
	Antonio Quartulli <antonio@...hcoding.com>,
	"Greg KH" <gregkh@...uxfoundation.org>,
	"bergwolf@...il.com" <bergwolf@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	David Miller <davem@...emloft.net>,
	"oleg.drokin@...el.com" <oleg.drokin@...el.com>,
	"jacques-charles.lafoucriere@....fr" 
	<jacques-charles.lafoucriere@....fr>,
	"jinshan.xiong@...el.com" <jinshan.xiong@...el.com>,
	netdev <netdev@...r.kernel.org>,
	"linux-metag@...r.kernel.org" <linux-metag@...r.kernel.org>
Subject: RE: [PATCH] drivers: staging: lustre: lustre: include: add
 "__attribute__((packed))" for the related union

From: James Hogan
> On 03/02/14 10:35, David Laight wrote:
> > From: James Hogan
> >> Combining __packed with __aligned(2) does the trick though (__packed
> >> alone sets __aligned(1) which is obviously going to be suboptimal).
...
> 
> Meta is also one of those arches, and according to my quick tests,
> __packed alone does correctly make it fall back to byte loads/stores,
> but with __packed __aligned(2) it uses 16bit loads/stores. I've also
> confirmed that with an ARM toolchain (see below for example).

I would either:
1a) Add explicit padding to the relevant structures so that they are
   multiple of 4 bytes.
or:
1b) #define some token to "__packed __aligned(2)" before all the structures
   that require changing, and use that in there definitions.
   This lets you comment on WHY you are doing it.
and:
2) Add a compile-time assert that the structures are the correct size.

Clearly you don't want to mark anything that contains a 32bit value
with __packed __aligned(2).

I'm not at all clear whether you are sometimes using a different compiler.

	David



--
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