I installed GCC. I then installed libasan-5.1.1-4.fc22. Next, I tried to run the following command: export CXXFLAGS="-fsanitize=address" make <copy to working directory> ./my_test.exe 2>&1 | sed "s|<old path>|<new path>|g" | asan_symbolize The command resulted in: bash: asan_symbolize: command not found... Searching for the following resulted in 0 hits: $ find /usr -name asan_symbolize /usr/local/bin/asan_symbolize $ find /usr -name asan_symbolize.py /usr/local/bin/asan_symbolize.py $ According to the Asan folks, pipe'ing to asan_symbolize is the way to handle a quick and dirty relocation of the program (https://groups.google.com/d/msg/address-sanitizer/OTzWjoZIfhY/NwdF3FKL5JAJ). Asan symbolize is available at https://code.google.com/p/address-sanitizer/. ********** $ lsb_release LSB Version: :core-4.1-amd64:core-4.1-noarch $ uname -a Linux localhost.localdomain 4.1.3-201.fc22.x86_64 #1 SMP Wed Jul 29 19:50:22 UTC $ yum list installed | grep gcc Yum command has been deprecated, redirecting to '/usr/bin/dnf list installed'. See 'man dnf' and 'man yum2dnf' for more information. gcc.x86_64 5.1.1-4.fc22 @System gcc-c++.x86_64 5.1.1-4.fc22 @System libgcc.x86_64 5.1.1-1.fc22 @System libgcc.x86_64 5.1.1-4.fc22 @System ********** Related, I seem to recall I had to install libubsan and libasan separately after installing GCC. If this is the case, then perhaps libubsan and libasan should be installed with GCC.
> > Searching for the following resulted in 0 hits: > > $ find /usr -name asan_symbolize > /usr/local/bin/asan_symbolize > $ find /usr -name asan_symbolize.py > /usr/local/bin/asan_symbolize.py > $ My pad, these should have been empty. The files are present above because I copied them from another machine.
You don't need to do that with gcc, libsanitizer in gcc uses libbacktrace to symbolize the output already.
(In reply to Jakub Jelinek from comment #2) > You don't need to do that with gcc, libsanitizer in gcc uses libbacktrace to > symbolize the output already. Thanks Jakub. I keep hitting problems like below. Are you certain GCC goes not need a symbolizer for Asan? ********** These are from a log file, so line numbers are added in front of the actual error reported by the tools. 41205:==1317== ERROR: AddressSanitizer: stack-buffer-overflow on address 0xbec57b18 at pc 0x38c651 bp 0xbec579e0 sp 0xbec579e4 41499:==1321== ERROR: AddressSanitizer: stack-buffer-overflow on address 0xbedbae9c at pc 0x6553f bp 0xbedbae68 sp 0xbedbae6c 41740:==2793== ERROR: AddressSanitizer: stack-buffer-overflow on address 0xbea67b18 at pc 0x38cbc5 bp 0xbea679e0 sp 0xbea679e4 42034:==2797== ERROR: AddressSanitizer: stack-buffer-overflow on address 0xbef0fe9c at pc 0x66117 bp 0xbef0fe68 sp 0xbef0fe6c ********** $ uname -a Linux cubietruck 3.4.39 #35 SMP PREEMPT Tue Sep 15 17:17:33 CST 2015 armv7l armv7l armv7l GNU/Linux $ g++ --version g++ (Ubuntu/Linaro 4.8.2-19ubuntu1) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc.
> These are from a log file, so line numbers are added in front of the actual > error reported by the tools. > > 41205:==1317== ERROR: AddressSanitizer: stack-buffer-overflow on address > 0xbec57b18 at pc 0x38c651 bp 0xbec579e0 sp 0xbec579e4 > > > 41499:==1321== ERROR: AddressSanitizer: stack-buffer-overflow on address > 0xbedbae9c at pc 0x6553f bp 0xbedbae68 sp 0xbedbae6c > > > 41740:==2793== ERROR: AddressSanitizer: stack-buffer-overflow on address > 0xbea67b18 at pc 0x38cbc5 bp 0xbea679e0 sp 0xbea679e4 > > > 42034:==2797== ERROR: AddressSanitizer: stack-buffer-overflow on address > 0xbef0fe9c at pc 0x66117 bp 0xbef0fe68 sp 0xbef0fe6c For completeness, the program being tested always uses -g2 (release build) and -g3 (debug build). -g is never omitted.
(In reply to Jeffrey Walton from comment #3) > (In reply to Jakub Jelinek from comment #2) > > You don't need to do that with gcc, libsanitizer in gcc uses libbacktrace to > > symbolize the output already. > > Thanks Jakub. > > I keep hitting problems like below. Are you certain GCC goes not need a > symbolizer for Asan? > I don't know what is different about things on my CubieTruck5 (Linaro, GCC 4.8.2), but I had to use asan_symbolize provided by Clang/Asan to get symbols for a GCC/Asan finding. Also see http://lists.linaro.org/pipermail/linaro-toolchain/2016-June/005786.html (start of thread) and http://lists.linaro.org/pipermail/linaro-toolchain/2016-July/005795.html (end of thread). The 005795 link includes an attachment for asan_symbolize from Clang, which can be used to get symbols from GCC/Asan findings.
(In reply to Jeffrey Walton from comment #5) > I don't know what is different about things on my CubieTruck5 (Linaro, GCC > 4.8.2), but I had to use asan_symbolize provided by Clang/Asan to get > symbols for a GCC/Asan finding. Everything is different in this regard between 4.8.x and 4.9.x. Only the latter has libbacktrace symbolization built in, the former doesn't have any symbolization.
Created attachment 1175375 [details] asan_symbolize for GCC 4.8 Attached is an asan_symbolize which can be used for GCC 4.8. The shebang is '/usr/bin/env python'. Someone may want to change it to '/usr/bin/env python2'. Alternately, run '2to3' on it and fix the three issues that surface. Also see http://github.com/google/sanitizers/issues/372.