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

On Mon, 20 Jun 2011, Alan Stern wrote:

> On Mon, 20 Jun 2011, Nicolas Pitre wrote:
> 
> > On Mon, 20 Jun 2011, Alan Stern wrote:
> > 
> > > On Sun, 19 Jun 2011, Nicolas Pitre wrote:
> > > 
> > > > > > The question is: does the structure really has to be packed?
> > > > > 
> > > > > What do you mean?  The structure really does need to be allocated
> > > > > without padding between the fields; is that the same thing?  So do a
> > > > > bunch of other structures that currently have no annotations at all.
> > > > 
> > > > Yes, that's the same thing.  The packed attribute tells the compiler 
> > > > that you don't want it to insert padding in it as it sees fit.
> > > 
> > > I thought the packed attribute does more than that.  For example, on
> > > some architectures doesn't it also force the compiler to use
> > > byte-oriented instructions for accessing the structure's fields?
> > 
> > Yes, but that's a consequence of not being able to access those fields 
> > in their naturally aligned position anymore.  Hence the addition of the 
> > align attribute to tell the compiler that we know that the structure is 
> > still aligned to a certain degree letting the compiler to avoid 
> > byte-oriented instructions when possible.
> 
> Not exactly.  As far as I can tell, the ((packed)) attribute caused the 
> compiler to change the structure's alignment from its natural value to 
> 1.  That's why the fields weren't in their naturally aligned positions 
> and why removing ((packed)) fixed the problem.

Are we talking past each other?

Remember that I was the one asking if the align attribute was needed in 
the first place.  If it is not then by all means please get rid of it!

But if it _is_ needed, then the generated code can be much better if the 
packed attribute is _also_ followed by the align attribute to 
increase it from 1.


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