このチュートの助けを借りてバグハンティングを試みます: https://fuzzing-project.org/tutorial2.html
アドレス サニタイザーを使用している場合、スタック トレースにシンボル解決がありません。
ここで説明する操作を試みます: GCC のアドレス サニタイザーの意味のあるスタック トレースですが、うまくいきません。私のOSはUbuntu 14.04です
私が取る手順は次のとおりです。
私は古典的なオフバイワンエラーであるCでテストプログラムを使用しています
int main() { int a[2] = {1, 0}; int b=a[2]; }
llvm 3.5をインストールします
apt-get
次の変数をエクスポートします
export AFL_USE_ASAN=1 export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5 export ASAN_OPTIONS=symbolize=1
次のコマンドでgcc 4.8.2でコンパイルします
gcc -o test -fsanitize=address -g3 -ggdb test.c
テスト プログラムを起動すると、バグ レポートに警告が表示されます。AddressSanitizer が llvm-symbolizer-3.5 に接続できないようです
==13382== ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff92d6b0e8 at pc 0x400845 bp 0x7fff92d6b0a0 sp 0x7fff92d6b098 READ of size 4 at 0x7fff92d6b0e8 thread T0 ==13382== WARNING: Can't read from symbolizer at fd 3 ==13382== WARNING: Can't read from symbolizer at fd 3 ==13382== WARNING: Can't read from symbolizer at fd 3 ==13382== WARNING: Can't read from symbolizer at fd 3 ==13382== WARNING: Can't read from symbolizer at fd 3 ==13382== WARNING: Can't read from symbolizer at fd 3 ==13382== WARNING: Failed to use and restart external symbolizer 0x400844 (/media/data/test+0x400844) 0x7fe5e7d4aec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4) 0x400688 (/media/data/test+0x400688) Address 0x7fff92d6b0e8 is located at offset 40 in frame <main> 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: 0x1000725a55c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000725a55d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000725a55e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000725a55f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000725a5600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x1000725a5610: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00[f4]f4 f4 0x1000725a5620: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 0x1000725a5630: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000725a5640: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000725a5650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000725a5660: 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 ==13382== ABORTING
そして、スタックトレースにシンボルがありません。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
また、Google ページ プロジェクトで説明されている python スクリプトを試してみましたasan_symbolize.py
が、結果はありませんでした。