public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: Richard Koch <n1gp@hotmail.com>
To: <crossgcc@sourceware.org>
Subject: RE: Compiler Memory Alignment Issue
Date: Fri, 03 Feb 2012 15:13:00 -0000	[thread overview]
Message-ID: <SNT112-W30C027ED9A23B7CED7924B87710@phx.gbl> (raw)
In-Reply-To: <20120203141359.GA13360@sig21.net>



Yann, Johannes, Bob, Martin, All,

Thank you for all your information. I have updated to
C-compiler 4.4.4 and am no longer seeing the alignment
issue.

I have also tried the suggestion to update /proc/cpu/alignment
and that works as well with the older compiler.

I will point out to the developers in my group to try to use
"compliant" coding methods when casting between types.

Thanks again.

-Rick Koch

----------------------------------------
> Date: Fri, 3 Feb 2012 15:13:59 +0100

> From: js@sig21.net

> To: yann.morin.1998@free.fr

> CC: crossgcc@sourceware.org; bob.dunlop@xyzzy.org.uk; n1gp@hotmail.com; martinwguy@gmail.com

> Subject: Re: Compiler Memory Alignment Issue

>

> Hi Yann,

>

> On Fri, Feb 03, 2012 at 02:21:23PM +0100, Yann E. MORIN wrote:

> > On Friday 03 February 2012 11:16:27 Bob Dunlop wrote:

> > > On Thu, Feb 02 at 01:15, Richard Koch wrote:

> > > > I'm seeing an alignment issue when I'm incrementing a pointer.

> >

> > I Just tried your .config and your sample C code, and it seems to work here

> > (with the buffer overflow fixed):

>

> As Martin Guy pointed out the issue may be caused

> by wrong alignment. In fact the behaviour of the code

> is undefined according to C99 if buffer is not suitably aligned:

> https://www.securecoding.cert.org/confluence/display/seccode/EXP36-C.+Do+not+convert+pointers+into+more+strictly+aligned+pointer+types

>

> I'd suggest to add a printf for the buffer address.

>

> For ARM, unaligned access is supported for ARMv6+, in ARMv5

> unaligned write is UNPREDICTABLE (unaligned read is

> defined as rotated read from aligned address).

> Not sure what's the default CPU for qemu-arm but

> Richard has ARMv5. I know Linux on ARM926EJ-S can

> fix it up in sw like Martin described, but I'm not

> sure every ARMv5 CPU supports alignment trap.

>

>

> Johannes

 		 	   		  

--
For unsubscribe information see http://sourceware.org/lists.html#faq

      parent reply	other threads:[~2012-02-03 15:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 18:15 Richard Koch
2012-02-02 23:09 ` Martin Guy
2012-02-02 23:26 ` Rod Nussbaumer
2012-02-03  9:52 ` Martin Guy
2012-02-03 10:16 ` Bob Dunlop
2012-02-03 13:21   ` Yann E. MORIN
2012-02-03 14:14     ` Johannes Stezenbach
2012-02-03 14:23       ` Yann E. MORIN
2012-02-03 20:41         ` Johannes Stezenbach
2012-02-03 15:13       ` Richard Koch [this message]

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=SNT112-W30C027ED9A23B7CED7924B87710@phx.gbl \
    --to=n1gp@hotmail.com \
    --cc=crossgcc@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).