summaryrefslogtreecommitdiffstats
path: root/HACKING.md
diff options
context:
space:
mode:
Diffstat (limited to 'HACKING.md')
-rw-r--r--HACKING.md30
1 files changed, 30 insertions, 0 deletions
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 @@