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: <201106202214.00998.arnd@arndb.de>
Date:	Mon, 20 Jun 2011 22:14:00 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	"Russell King - ARM Linux" <linux@....linux.org.uk>
Cc:	Nicolas Pitre <nico@...xnic.net>,
	Alan Stern <stern@...land.harvard.edu>, gregkh@...e.de,
	linux-usb@...r.kernel.org, lkml <linux-kernel@...r.kernel.org>,
	Rabin Vincent <rabin@....in>,
	Alexander Holler <holler@...oftware.de>,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] USB: ehci: use packed, aligned(4) instead of removing the packed attribute

On Monday 20 June 2011 21:32:13 Russell King - ARM Linux wrote:
> > Here the d member is not naturally aligned.  On most architectures, 
> > including ARM with the ABI currently in use, the compiler would insert a 
> > 32-bit padding between c and d.
> 
> And if 'struct foo' represents a structure in device memory, the end
> result is highly unpredicable whether or not you have padding or
> accessors to load 'd' there.  So, you would not have such a structure
> describing a data structure in memory returned by ioremap().

Right.

> Now, the real question is: is there any architecture which is (or may
> be) supported by the Linux kernel which would add padding to:
> 
> struct foo {
>         u8 a;
>         u8 b;
>         u16 c;
>         u32 d;
>         u64 e;
> };

This is the other issue, which we were facing in the scsi drivers.
If an architecture requires padding because some members require
larger than natural alignment here, the 'packed' should be applied
to that member, in order to change the alignment of that member.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ