我尝试使用以下tuto:https://fuzzing-project.org/tutorial2.html来进行bug搜索。
当我使用地址消毒剂时,堆栈跟踪上没有任何符号解析。
我尝试了下面的操作描述:GCC中有意义的地址杀菌剂堆栈跟踪,但它对我不起作用。我的操作系统是Ubuntu 14.04
以下是我所采取的步骤:
apt-get安装了llvm3.5而且我在书签上没有任何符号。如果我执行sudo,我没有任何警告,但我也没有任何符号分辨率。
==13392== ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff911555e8 at pc 0x400845 bp 0x7fff911555a0 sp 0x7fff91155598
READ of size 4 at 0x7fff911555e8 thread T0
0x400844 (/media/data/test+0x400844)
0x7f4721057ec4 (/lib/x86_64-linux-gnu/libc-2.19.so+0x21ec4)
0x400688 (/media/data/test+0x400688)
Address 0x7fff911555e8 is located at offset 40 in frame of T0's stack:
This frame has 1 object(s):
[32, 40) 'a'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
(longjmp and C++ exceptions are supported)
Shadow bytes around the buggy address:
0x100072222a60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100072222a70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100072222a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100072222a90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100072222aa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x100072222ab0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00[f4]f4 f4
0x100072222ac0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
0x100072222ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100072222ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100072222af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100072222b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap righ redzone: fb
Freed Heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
==13392== ABORTING
I also try the python script asan_symbolize.py describes in the google page project but without any results.
https://code.google.com/p/address-sanitizer/wiki/CallStack发布于 2015-04-18 18:59:17
我更新到gcc 4.9。现在起作用了。下面是我在Ubuntu中更新的步骤。
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9这里有更多详细信息:https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-4-9-on-ubuntu-14-04
发布于 2015-07-21 12:22:32
出口ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5 ..。阅读0x7fff911555e8线程T0 0x400844 (/media/data/test+0x400844) 0x7f4721057ec4 (/lib/x86_64-linux-gnu/libc-2.19.so+0x21ec4) 0x400688 (/media/data/test+0x400688)
在Clang下,您需要通过asan_symbolize传输输出以获取符号。我讨论Clang是因为您清楚地使用了LLVM齿轮(上面的llvm符号-3.5)。所以你应该做这样的事:
./test 2>&1 | asan_symbolize我有asan_symbolize在/usr/bin和/usr/local/bin
$ find /usr/ -name asan*
/usr/bin/asan_symbolize
/usr/lib/llvm-3.4/lib/clang/3.4/include/sanitizer/asan_interface.h
/usr/local/bin/asan_symbolize.py
/usr/local/lib/clang/3.5.0/include/sanitizer/asan_interface.h我有两个副本,因为其中一个是通过apt-get (/usr/bin/asan_symbolize)与Clang一起安装的,我有时会从源代码(/usr/local/bin/asan_symbolize.py)构建Clang。
如果您有没有副本,那么我相信您可以从Google上的地址-消毒液获取它。
一旦开始使用asan_symbolize,可能会遇到asan_symbolize由于路径更改而找不到符号的情况(例如,程序或库从其构建位置复制到目标目录)。有关这一点,请参见Asan邮件列表上的象征?。
在kcc的回答中,他的意思是:
./test 2>&1 | sed "s/<old path>/<new path>/g" | asan_symbolize(我想我在测试Postgres时必须这样做)。
我最近开始使用GCC的消毒液,但是我从来没有用过asan_symbolize和GCC。我不知道这对你有多好。天真地,我希望它能像预期的那样起作用。
我用gcc 4.8.2用以下命令编译..。
我不知道混合/匹配对你有多好。也许你应该坚持GCC,或者你应该安装Clang并使用它。
Python在Clang和它的杀菌剂在基于Clang的动态分析有一个速成课程。它讨论了诸如获取堆栈跟踪之类的主题。(我为Python项目编写了页面,以帮助他们将Clang及其消毒液添加到发布工程过程中)。
https://stackoverflow.com/questions/29708121
复制相似问题