public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work
@ 2013-01-02  6:26 hjl.tools at gmail dot com
  2013-01-02  7:13 ` [Bug sanitizer/55844] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2013-01-02  6:26 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844

             Bug #: 55844
           Summary: -fsanitize=address -Os -fno-omit-frame-pointer
                    -mno-omit-leaf-frame-pointer -m64 doesn't work
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com
                CC: dodji@gcc.gnu.org, dvyukov@gcc.gnu.org,
                    jakub@gcc.gnu.org, kcc@gcc.gnu.org


c-c++-common/asan/null-deref-1.c fails with -m64 since

-fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
-m64 

still omit frame pointer:

[hjl@gnu-tools-1 gcc]$  cat /tmp/x.c
void
NullDeref(int *ptr)
{
  ptr[10]++;
}
[hjl@gnu-tools-1 gcc]$
/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/ /tmp/x.c   -S   -Os 
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -m64 -fsanitize=address
[hjl@gnu-tools-1 gcc]$ cat x.s
    .file    "x.c"
    .text
    .globl    NullDeref
    .type    NullDeref, @function
NullDeref:
.LFB0:
    .cfi_startproc
    movq    %rdi, %rax
    leaq    40(%rdi), %rdi
    movabsq    $17592186044416, %rdx
    movq    %rdi, %rcx
    shrq    $3, %rcx
    movb    (%rcx,%rdx), %dl
    movq    %rdi, %rcx
    andl    $7, %ecx
    addl    $3, %ecx
    cmpb    %dl, %cl
    jl    .L2
    testb    %dl, %dl
    je    .L2
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    call    __asan_report_load4
.L2:
    .cfi_def_cfa 7, 8
    .cfi_restore 6
    incl    40(%rax)
    ret
    .cfi_endproc
.LFE0:
    .size    NullDeref, .-NullDeref
    .section    .text.startup,"ax",@progbits
    .type    _GLOBAL__sub_I_00099_0_NullDeref, @function
_GLOBAL__sub_I_00099_0_NullDeref:
.LFB1:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    popq    %rbp
    .cfi_def_cfa 7, 8
    jmp    __asan_init
    .cfi_endproc
.LFE1:
    .size    _GLOBAL__sub_I_00099_0_NullDeref,
.-_GLOBAL__sub_I_00099_0_NullDeref
    .section    .init_array.00099,"aw"
    .align 8
    .quad    _GLOBAL__sub_I_00099_0_NullDeref
    .ident    "GCC: (GNU) 4.8.0 20130101 (experimental)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-tools-1 gcc]$
/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/ /tmp/x.c   -S   -Os 
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -m64 
[hjl@gnu-tools-1 gcc]$ cat x.s
    .file    "x.c"
    .text
    .globl    NullDeref
    .type    NullDeref, @function
NullDeref:
.LFB0:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    incl    40(%rdi)
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    popq    %rbp
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .size    NullDeref, .-NullDeref
    .ident    "GCC: (GNU) 4.8.0 20130101 (experimental)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-tools-1 gcc]$


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sanitizer/55844] -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work
  2013-01-02  6:26 [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work hjl.tools at gmail dot com
@ 2013-01-02  7:13 ` pinskia at gcc dot gnu.org
  2013-01-02  7:31 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-02  7:13 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-02
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-02 07:13:33 UTC ---
It has a frame pointer:
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp

Right there.

The issue is you also need to disable shrink wrapping (-fno-shrink-wrap).  This
again why we should just move over to using the dwarf unwdinder and forget
about the manually unwinding the stack.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sanitizer/55844] -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work
  2013-01-02  6:26 [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work hjl.tools at gmail dot com
  2013-01-02  7:13 ` [Bug sanitizer/55844] " pinskia at gcc dot gnu.org
@ 2013-01-02  7:31 ` jakub at gcc dot gnu.org
  2013-01-02 17:31 ` kcc at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-02  7:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-02 07:30:55 UTC ---
http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01179.html


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sanitizer/55844] -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work
  2013-01-02  6:26 [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work hjl.tools at gmail dot com
  2013-01-02  7:13 ` [Bug sanitizer/55844] " pinskia at gcc dot gnu.org
  2013-01-02  7:31 ` jakub at gcc dot gnu.org
@ 2013-01-02 17:31 ` kcc at gcc dot gnu.org
  2013-01-02 21:07 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kcc at gcc dot gnu.org @ 2013-01-02 17:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844

--- Comment #3 from Kostya Serebryany <kcc at gcc dot gnu.org> 2013-01-02 17:31:05 UTC ---
>> we should just move over to using the dwarf unwinder and forget about the manually unwinding the stack

Upstream asan-rt has two flags now: 
----------
fast_unwind_on_fatal     1     Use Fast/Slow unwinder when found a bug. The
fast one relies on frame pointers, while slow one does not. The default may
change to 0 soon.
fast_unwind_on_malloc     1     Same as fast_unwind_on_fatal, but control
unwinding inside malloc/free, i.e. performance critical.
----------

I am going to switch the default for fast_unwind_on_fatal to 0 somewhere in Jan
and then merge to gcc. 

fast_unwind_on_malloc will remain 1 by default; see the rationale in 
http://code.google.com/p/address-sanitizer/issues/detail?id=137#c6


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sanitizer/55844] -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work
  2013-01-02  6:26 [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2013-01-02 17:31 ` kcc at gcc dot gnu.org
@ 2013-01-02 21:07 ` jakub at gcc dot gnu.org
  2013-01-03  6:18 ` kcc at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-02 21:07 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-02 21:07:21 UTC ---
Could you please do an extra merge soon, even before switching the default?
You've raised some cases where on ubuntu _Unwind_* based backtrace wasn't
accurrate, it would be nice to check it out on other distros and find out the
reason.  BTW, glibc backtrace(3) on i?86 (32-bit only) uses a combination of
_Unwind_* based backtrace for as long as unwind info is provided, and then
grabs ebp from the unwind info at the outermost frame before unwind info isn't
provided, and from there attempts to use the fast backtrace method (for cases
where older i?86 code when gcc still didn't default to asynchronous unwind
tables on i?86 calls newer code where gcc defaults to it).  On x86_64 this
isn't done, as asynchronous unwind tables have been the default basically for
the whole support of the architecture.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sanitizer/55844] -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work
  2013-01-02  6:26 [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2013-01-02 21:07 ` jakub at gcc dot gnu.org
@ 2013-01-03  6:18 ` kcc at gcc dot gnu.org
  2013-01-08  8:14 ` jakub at gcc dot gnu.org
  2013-01-08  8:45 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: kcc at gcc dot gnu.org @ 2013-01-03  6:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844

--- Comment #5 from Kostya Serebryany <kcc at gcc dot gnu.org> 2013-01-03 06:17:38 UTC ---
>> Could you please do an extra merge soon, even before switching the default?
I'll start somewhere after Jan 10. 
(I am on holidays before that. There are substantial changes in asan-rt, 
I afraid I won't be able to fix things if they break on non-x86 before I am
back to office)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sanitizer/55844] -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work
  2013-01-02  6:26 [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2013-01-03  6:18 ` kcc at gcc dot gnu.org
@ 2013-01-08  8:14 ` jakub at gcc dot gnu.org
  2013-01-08  8:45 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-08  8:14 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-08 08:14:12 UTC ---
Author: jakub
Date: Tue Jan  8 08:14:04 2013
New Revision: 195005

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195005
Log:
    PR sanitizer/55844
    * c-c++-common/asan/null-deref-1.c: Add -fno-shrink-wrap to
    dg-options.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/asan/null-deref-1.c


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sanitizer/55844] -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work
  2013-01-02  6:26 [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2013-01-08  8:14 ` jakub at gcc dot gnu.org
@ 2013-01-08  8:45 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-08  8:45 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-08 08:44:44 UTC ---
Worked around, likely going to be fixed with switch to unwind based backtrace
for fatal backtraces.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-01-08  8:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-02  6:26 [Bug sanitizer/55844] New: -fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 doesn't work hjl.tools at gmail dot com
2013-01-02  7:13 ` [Bug sanitizer/55844] " pinskia at gcc dot gnu.org
2013-01-02  7:31 ` jakub at gcc dot gnu.org
2013-01-02 17:31 ` kcc at gcc dot gnu.org
2013-01-02 21:07 ` jakub at gcc dot gnu.org
2013-01-03  6:18 ` kcc at gcc dot gnu.org
2013-01-08  8:14 ` jakub at gcc dot gnu.org
2013-01-08  8:45 ` jakub at gcc dot gnu.org

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).