public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/60281] New: Address Sanitizer triggers alignment fault in ARM machines
@ 2014-02-20 8:07 manjian2006 at gmail dot com
2014-02-20 8:20 ` [Bug middle-end/60281] " manjian2006 at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: manjian2006 at gmail dot com @ 2014-02-20 8:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60281
Bug ID: 60281
Summary: Address Sanitizer triggers alignment fault in ARM
machines
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: manjian2006 at gmail dot com
Without aligning the asan stack base,this base will only 64-bit aligned in ARM
machines.
But asan require 256-bit aligned base because of this:
1.right shift take ASAN_SHADOW_SHIFT ,which is 3,bits are zeros
2.store multiple/load multiple instructions require the other 2 bits are zeros
that add up lowest 5 bits should be zeros.That means 32 bytes or 256 bits
aligned.
Here is the test case:
#include <time.h>
int foo()
{
struct timespec timeNow1 ;
clock_gettime( 0, &timeNow1);
return static_cast<double>(timeNow1.tv_sec);
}
compiles command:
arm-linux-androideabi-g++ -march=armv7-a -mthumb -Os -fsanitize=address -S
1.cpp
which generates assembly as:
push {r4, r5, r6, r7, lr} @ save 5*4 = 20 bytes
sub sp, sp, #100 @ save 20 + 100 = 120 bytes
...
mov r4, sp
...
lsrs r5, r4, #3 @ as -120 is 11111111111111111111111110001000
r5 is aligned to 1 bits
...
stmia r5, {r1, r2, r3} @ trigger alignment fault
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/60281] Address Sanitizer triggers alignment fault in ARM machines
2014-02-20 8:07 [Bug middle-end/60281] New: Address Sanitizer triggers alignment fault in ARM machines manjian2006 at gmail dot com
@ 2014-02-20 8:20 ` manjian2006 at gmail dot com
2014-04-22 5:56 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: manjian2006 at gmail dot com @ 2014-02-20 8:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60281
--- Comment #1 from linzj <manjian2006 at gmail dot com> ---
I have summit a patch for this bug,and tested in my Nexus 4.It works fine.Check
gcc-patches at gcc dot gnu dot org for that.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/60281] Address Sanitizer triggers alignment fault in ARM machines
2014-02-20 8:07 [Bug middle-end/60281] New: Address Sanitizer triggers alignment fault in ARM machines manjian2006 at gmail dot com
2014-02-20 8:20 ` [Bug middle-end/60281] " manjian2006 at gmail dot com
@ 2014-04-22 5:56 ` jakub at gcc dot gnu.org
2014-04-22 13:15 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-04-22 5:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60281
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue Apr 22 05:55:40 2014
New Revision: 209554
URL: http://gcc.gnu.org/viewcvs?rev=209554&root=gcc&view=rev
Log:
PR middle-end/60281
* asan.c (asan_emit_stack_protection): Force the base to align to
appropriate bits if STRICT_ALIGNMENT. Set shadow_mem align to
appropriate bits if STRICT_ALIGNMENT.
* cfgexpand.c (expand_stack_vars): Set base_align appropriately
when asan is on.
(expand_used_vars): Leave a space in the stack frame for alignment
if STRICT_ALIGNMENT.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/asan.c
trunk/gcc/cfgexpand.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/60281] Address Sanitizer triggers alignment fault in ARM machines
2014-02-20 8:07 [Bug middle-end/60281] New: Address Sanitizer triggers alignment fault in ARM machines manjian2006 at gmail dot com
2014-02-20 8:20 ` [Bug middle-end/60281] " manjian2006 at gmail dot com
2014-04-22 5:56 ` jakub at gcc dot gnu.org
@ 2014-04-22 13:15 ` jakub at gcc dot gnu.org
2014-08-12 11:59 ` ramana at gcc dot gnu.org
2014-08-13 7:00 ` manjian2006 at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-04-22 13:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60281
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue Apr 22 13:15:24 2014
New Revision: 209625
URL: http://gcc.gnu.org/viewcvs?rev=209625&root=gcc&view=rev
Log:
PR middle-end/60281
* asan.c (asan_emit_stack_protection): Force the base to align to
appropriate bits if STRICT_ALIGNMENT. Set shadow_mem align to
appropriate bits if STRICT_ALIGNMENT.
* cfgexpand.c (expand_stack_vars): Set base_align appropriately
when asan is on.
(expand_used_vars): Leave a space in the stack frame for alignment
if STRICT_ALIGNMENT.
Modified:
branches/gcc-4_9-branch/gcc/ChangeLog
branches/gcc-4_9-branch/gcc/asan.c
branches/gcc-4_9-branch/gcc/cfgexpand.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/60281] Address Sanitizer triggers alignment fault in ARM machines
2014-02-20 8:07 [Bug middle-end/60281] New: Address Sanitizer triggers alignment fault in ARM machines manjian2006 at gmail dot com
` (2 preceding siblings ...)
2014-04-22 13:15 ` jakub at gcc dot gnu.org
@ 2014-08-12 11:59 ` ramana at gcc dot gnu.org
2014-08-13 7:00 ` manjian2006 at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: ramana at gcc dot gnu.org @ 2014-08-12 11:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60281
Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |ramana at gcc dot gnu.org
Resolution|--- |FIXED
Target Milestone|--- |4.9.1
--- Comment #4 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
>From code generated currently - looks fixed for 4.9.1 since GCC 4.9.0 was
actually released on 22nd April !
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/60281] Address Sanitizer triggers alignment fault in ARM machines
2014-02-20 8:07 [Bug middle-end/60281] New: Address Sanitizer triggers alignment fault in ARM machines manjian2006 at gmail dot com
` (3 preceding siblings ...)
2014-08-12 11:59 ` ramana at gcc dot gnu.org
@ 2014-08-13 7:00 ` manjian2006 at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: manjian2006 at gmail dot com @ 2014-08-13 7:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60281
--- Comment #5 from linzj <manjian2006 at gmail dot com> ---
Sorry, but I have to wait for my GNU assignment.
(In reply to Ramana Radhakrishnan from comment #4)
> From code generated currently - looks fixed for 4.9.1 since GCC 4.9.0 was
> actually released on 22nd April !
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-13 7:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-20 8:07 [Bug middle-end/60281] New: Address Sanitizer triggers alignment fault in ARM machines manjian2006 at gmail dot com
2014-02-20 8:20 ` [Bug middle-end/60281] " manjian2006 at gmail dot com
2014-04-22 5:56 ` jakub at gcc dot gnu.org
2014-04-22 13:15 ` jakub at gcc dot gnu.org
2014-08-12 11:59 ` ramana at gcc dot gnu.org
2014-08-13 7:00 ` manjian2006 at gmail dot com
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).