a11078a78c
This adds support for `afl-fuzz -Q`, which can be used to instrument arbitrary black-box binary code for fuzz testing using American Fuzzy Lop through QEMU emulation. This requires a custom QEMU 2.2.0 build of the Linux userspace emulators (system emulators aren't required) with some custom patches. Furthermore we have to patch the patches a little to make the build more sane (there are some notes in the README about this). Overall, the addition of this feature by default doesn't significantly impact build times (since building QEMU for only one target builds only a fraction of the source code, and many features are disabled), so it's enabled by default. Signed-off-by: Austin Seipp <aseipp@pobox.com>
19 lines
814 B
Diff
19 lines
814 B
Diff
--- qemu-2.2.0/translate-all.c.orig 2014-12-09 14:45:46.000000000 +0000
|
|
+++ qemu-2.2.0/translate-all.c 2015-01-28 22:37:42.383000000 +0000
|
|
@@ -387,8 +387,13 @@
|
|
/* We can't use g_malloc because it may recurse into a locked mutex. */
|
|
# define ALLOC(P, SIZE) \
|
|
do { \
|
|
- P = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, \
|
|
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
|
|
+ void* _tmp = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, \
|
|
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
|
|
+ if (_tmp == (void*)-1) { \
|
|
+ qemu_log(">>> Out of memory for stack, bailing out. <<<\n"); \
|
|
+ exit(1); \
|
|
+ } \
|
|
+ (P) = _tmp; \
|
|
} while (0)
|
|
#else
|
|
# define ALLOC(P, SIZE) \
|