ramosian-glider / sanitizers

0 stars 0 forks source link

[GCC] fully-qualified names in ASan reports #145

Closed ramosian-glider closed 9 years ago

ramosian-glider commented 9 years ago

Originally reported on Google Code with ID 144

What steps will reproduce the problem?
1. Take example (using LLVM/Clang) provided in http://code.google.com/p/address-sanitizer/wiki/ExampleHeapOutOfBounds

2. I used:

    g++ -g3 -O0 -fsanitize=address -fno-omit-frame-pointer test.cc

I also tried different -g levels, -O levels and dropping "-fno-omit-frame-pointer".

What is the expected output? What do you see instead?

All stack traces contains binaries+offset, but do not provide fully-qualified names
like in the example with LLVM/Clang. Is there a way to get more human-friendly output
with GNU GCC, .i.e., as in the example with LLVM/Clang? Or am I forced to use objdump
comparing ASM w/ source to locate the issue in the initial ASan implementation on GNU
GCC?

GNU GCC partial output:

==13339== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x2b8501e1fe14 at
pc 0x4007f3 bp 0x7fff1c638a30 sp 0x7fff1c638a28
READ of size 4 at 0x2b8501e1fe14 thread T0
    #0 0x4007f2 (/build/davidlt/gcc480/testing/a.out+0x4007f2)
    #1 0x303181d993 (/lib64/libc-2.5.so+0x1d993)
0x2b8501e1fe14 is located 4 bytes to the right of 400-byte region [0x2b8501e1fc80,0x2b8501e1fe10)
allocated by thread T0 here:
    #0 0x2b84ff1cb8ba (/build/davidlt/gcc480/test/slc5_amd64_gcc480/external/gcc/4.8.0/lib64/libasan.so.0.0.0+0xe8ba)
    #1 0x2b84ff0fc6ec (/build/davidlt/gcc480/test/slc5_amd64_gcc480/external/gcc/4.8.0/lib64/libstdc++.so.6.0.18+0x646ec)
    #2 0x303181d993 (/lib64/libc-2.5.so+0x1d993)

What version of the product are you using? On what operating system?

# GNU GCC 4.8.0 (experimental, r195310).
# GNU GCC compiled with release checking.
$ gcc --version
gcc (GCC) 4.8.0 20130119 (experimental)
$ gcc -dumpmachine
x86_64-unknown-linux-gnu
$ cat /etc/redhat-release
Scientific Linux CERN SLC release 5.8 (Boron)

Please provide any additional information below.

Reported by David.Abdurachmanov on 2013-01-19 14:31:36

ramosian-glider commented 9 years ago
Pipe the output of the command through asan_symbolize.py:
https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py

Reported by rnk@google.com on 2013-01-19 14:36:44

ramosian-glider commented 9 years ago
or read more at https://code.google.com/p/address-sanitizer/wiki/CallStack

Reported by konstantin.s.serebryany on 2013-01-19 15:39:06

ramosian-glider commented 9 years ago
Thanks. It works as expected with asan_symbolize.py and c++filt, yet the script is not
included into GNU GCC (trunk). 

Reported by David.Abdurachmanov on 2013-01-19 15:43:38

ramosian-glider commented 9 years ago
Not that we are going to fully switch to llvm-symbolizer in near future.
We indeed need to do something in the gcc world (at least extend the documentation).

Reported by konstantin.s.serebryany on 2013-01-19 15:49:10

ramosian-glider commented 9 years ago
s/Not that/Note that/

Reported by konstantin.s.serebryany on 2013-01-19 15:53:52

ramosian-glider commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:13:40