From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: ARM unaligned MMIO access with attribute((packed))
Date: Wed, 2 Feb 2011 17:09:59 +0000 [thread overview]
Message-ID: <20110202170959.GA31043@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <AANLkTin6qEeN7XZuwePNWqS8i_aDY586V+sOqgD5pPQA@mail.gmail.com>
On Wed, Feb 02, 2011 at 05:51:27PM +0100, Richard Guenther wrote:
> > I would suggest fixing this by:
> >
> > 1. auditing all uses of __attribute__((packed)) in the Linux USB code
> > and other drivers, removing the ones that are potentially harmful.
> >
> > 2. Changing the ARM MMIO functions to use inline assembly instead of
> > direct pointer dereference.
> >
> > 3. Documenting the gcc behavior as undefined.
>
> The pointer conversions already invoke undefined behavior as specified by the
> C standard (6.3.2.3/7).
Just to be clear: you are not saying that the ARM implementation is
undefined.
What you're saying is that converting from a pointer with less strict
alignment requirements to a pointer with more strict alignment
requirements is undefined.
IOW:
unsigned long *blah(unsigned char *c)
{
return (unsigned long *)c;
}
would be undefined, but:
unsigned char *blah(unsigned long *c)
{
return (unsigned char *)c;
}
would not be.
If you're saying something else, please explain with reference to the
point in the C standard you quote above.
next prev parent reply other threads:[~2011-02-02 17:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-02 16:00 ARM unaligned MMIO access with attribute((packed)) Arnd Bergmann
2011-02-02 16:37 ` Russell King - ARM Linux
2011-02-02 17:39 ` Arnd Bergmann
2011-02-02 19:14 ` Ian Lance Taylor
2011-02-02 21:38 ` David Miller
2011-02-02 21:45 ` Russell King - ARM Linux
2011-02-02 21:59 ` David Miller
[not found] ` <yw1xei7qm3vy.fsf@unicorn.mansr.com>
2011-02-02 23:23 ` David Miller
2011-02-03 9:26 ` Arnd Bergmann
2011-02-03 15:03 ` Arnd Bergmann
2011-02-02 16:51 ` Richard Guenther
2011-02-02 17:09 ` Russell King - ARM Linux [this message]
2011-02-02 17:39 ` Joseph S. Myers
2011-04-26 15:00 ` Rabin Vincent
2011-04-26 18:51 ` Alan Stern
2011-04-27 14:06 ` Rabin Vincent
2011-04-27 16:25 ` Alan Stern
2011-04-27 16:37 ` Arnd Bergmann
2011-04-28 13:35 ` Alan Stern
2011-04-28 14:16 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110202170959.GA31043@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).