AFLplusplus / qemuafl

This fork of QEMU enables fuzzing userspace ELF binaries under AFL++.
https://aflplus.plus
Other
79 stars 42 forks source link

*** DO NOT MERGE *** - Tcg cov #53

Open WorksButNotTested opened 1 year ago

andreafioraldi commented 1 year ago

Inlined TCG is not thread safe, that's why the map update is in the helper

WorksButNotTested commented 1 year ago

Does QEMU serialize the execution of helpers between threads?

andreafioraldi commented 1 year ago

Does QEMU serialize the execution of helpers between threads?

no, but the helper is native code and so we can use the TLS for prev loc

WorksButNotTested commented 1 year ago

Ah gotcha, so map access is concurrent (and possibly racy if two threads happen to update the same map offset at the same time), but the issue is that each thread should have its own prev_loc (thread local storage) and my TCG code is using the address of prev_loc calculated when the block is compiled and compiled blocks are shared between threads?

So a TCG implementation is possible, (since it can successfully emulate multithreaded apps with TLS), but my implementation is naive and should instead determine the location of the TLS prev_loc at runtime?

WorksButNotTested commented 1 year ago

Fuzzbench results: