diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-03-02 17:11:30 -0800 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-03-19 10:41:28 -0700 |
commit | 5560e2e26bd9ed6968ed6971610d68846ead7a86 (patch) | |
tree | cdce5bc31cf64b1f50ed9223b49ea78cfeaeedb1 /HACKING.md | |
parent | 81aa36a8a95935cc1d579858de47496a9a2020fa (diff) | |
download | ninja-5560e2e26bd9ed6968ed6971610d68846ead7a86.tar.gz |
Add notes on using afl-fuzz to HACKING.
Diffstat (limited to 'HACKING.md')
-rw-r--r-- | HACKING.md | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -177,3 +177,33 @@ root directory: gcov build/*.o Look at the generated `.gcov` files directly, or use your favorit gcov viewer. + +### Using afl-fuzz + +Build with afl-clang++: + + CXX=path/to/afl-1.20b/afl-clang++ ./configure.py + ninja + +Then run afl-fuzz like so: + + afl-fuzz -i misc/afl-fuzz -o /tmp/afl-fuzz-out ./ninja -n -f @@ + +You can pass `-x misc/afl-fuzz-tokens` to use the token dictionary. In my +testing, that did not seem more effective though. + +#### Using afl-fuzz with asan + +If you want to use asan (the `isysroot` bit is only needed on OS X; if clang +can't find C++ standard headers make sure your LLVM checkout includes a libc++ +checkout and has libc++ installed in the build directory): + + CFLAGS="-fsanitize=address -isysroot $(xcrun -show-sdk-path)" \ + LDFLAGS=-fsanitize=address CXX=path/to/afl-1.20b/afl-clang++ \ + ./configure.py + AFL_CXX=path/to/clang++ ninja + +Make sure ninja can find the asan runtime: + + DYLD_LIBRARY_PATH=path/to//lib/clang/3.7.0/lib/darwin/ \ + afl-fuzz -i misc/afl-fuzz -o /tmp/afl-fuzz-out ./ninja -n -f @@ |