From 5560e2e26bd9ed6968ed6971610d68846ead7a86 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 2 Mar 2015 17:11:30 -0800 Subject: Add notes on using afl-fuzz to HACKING. --- HACKING.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'HACKING.md') diff --git a/HACKING.md b/HACKING.md index e3940ff..9c6830f 100644 --- a/HACKING.md +++ b/HACKING.md @@ -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 @@ -- cgit v1.2.3