*
aghuf...@gmail.com, 2017-11-14, 10:47:
>I want to know if and how can i use afl with thread sanitizer.
It's not supported out-of-the-box, but I guess you could make it work.
>afl-gcc -fsanitize=thread -fno-stack-protector -z exestack program.c
>-o a.out
I guess "exestack" is a typo for "execstack"? (I don't know why would
you want to make the stack executable, though...)
afl-gcc's instrumentation doesn't play well with heavy use of threads.
I recommend using afl-clang-fast instead.
>afl-fuzz -i ./testcases/ -o ./results/ ./a.out
TSan outright refuses to work if there's any virtual memory limit, so
you will need to pass "-m none" to afl-fuzz. (But that means afl-fuzz
won't protect you from the target program eating all the memory...)
You will also need to set TSAN_OPTIONS=abort_on_error=1:symbolize=0 in
the environment, so that afl-fuzz can catch TSan's warnings, and TSan
doesn't waste time on prettifying backtraces. (Old versions of TSan
runtime might not support these options, so you should check they
actually work before you start fuzzing.)
There might be more gotchas! I haven't tried fuzzing anything with
TSan myself.
--
Jakub Wilk