Hi Connor,
On 11.09.21 03:31, Connor Shugg wrote:
> Based on previous conversations I've found here regarding
> multithreading, the consensus seems to be that AFL /does /support the
> fuzzing of multithreaded targets.
I am not sure what you mean by "support" - but sure you can instrument
and fuzz them :)
> From what I can tell, fuzzing a program that spawns some number
> of threads would probably decrease the fuzzer's "stability" score,
> considering pthread scheduling isn't necessarily deterministic. But my
> main question(s) are:
>
> * Despite a stability decrease, is it still feasible to fuzz
> multithreaded targets?
it is feasible, though the lesser the stability the more pointless queue
entries. AFL++ tries to make this less an issue though by ignoring
unstable edges.
> o As an end goal: is it feasible to try to have AFL discover a
> deadlock situation? (That would be /awesome/.)
if you would trigger one, it would be detected as a hang, however due to
the nature of such issues it would not be repeatable and therefore not
be saved as a timeout test case.
For such things compile with -fsanitize=thread for a better detection of
threading issues.
> * How does having multiple threads (all running /instrumented/ code)
> affect AFL's shared memory region used to track target behavior?
well they all write to the same memory map. so if one thread is doing
things that has nothing to do with your fuzzing input then this fills up
the queue with unnecessary inputs and decreases the stability.
You should use AFL++'s AFL_LLVM_ALLOWLIST/AFL_LLVM_DENYLIST feature to
only instrument what you want to fuzz and not the rest and/or disable
the threads that you are not interested in in the code.
> * Is AFL's instrumentation thread-safe? Or is it not - meaning
> multiple threads could be writing to the /same /memory region
> simultaneously.
AFL's instrumentation is not thread-safe.
AFL++'s instrumentation is thread-safe if you compile the target with
AFL_LLVM_THREADSAFE_INST=1
Regards,
Marc
--
Marc Heuse
www.mh-sec.de
PGP: AF3D 1D4C D810 F0BB 977D 3807 C7EE D0A0 6BE9 F573