diff options
author | Andrea Fioraldi <andreafioraldi@gmail.com> | 2019-10-08 09:43:38 +0200 |
---|---|---|
committer | Andrea Fioraldi <andreafioraldi@gmail.com> | 2019-10-08 09:43:38 +0200 |
commit | 78d9fa280c1fb8a746527ed4fe93f507b13df213 (patch) | |
tree | c731612437cff672983b3b5f6f7cf6ad0c2e51dc /qemu_mode/patches/afl-qemu-cpu-inl.h | |
parent | 16551643b30f389fb7b0df1a8bd69c69ef856411 (diff) | |
download | afl++-78d9fa280c1fb8a746527ed4fe93f507b13df213.tar.gz |
qemu maps debug print
Diffstat (limited to 'qemu_mode/patches/afl-qemu-cpu-inl.h')
-rw-r--r-- | qemu_mode/patches/afl-qemu-cpu-inl.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/qemu_mode/patches/afl-qemu-cpu-inl.h b/qemu_mode/patches/afl-qemu-cpu-inl.h index 8660ba23..cda980e0 100644 --- a/qemu_mode/patches/afl-qemu-cpu-inl.h +++ b/qemu_mode/patches/afl-qemu-cpu-inl.h @@ -231,6 +231,21 @@ static void afl_setup(void) { } + +static void print_mappings(void) { + + u8 buf[MAX_LINE]; + FILE* f = fopen("/proc/self/maps", "r"); + + if (!f) return; + + while (fgets(buf, MAX_LINE, f)) + printf("%s", buf); + + fclose(f); + +} + /* Fork server logic, invoked once we hit _start. */ static void afl_forkserver(CPUState *cpu) { @@ -239,6 +254,9 @@ static void afl_forkserver(CPUState *cpu) { if (forkserver_installed == 1) return; forkserver_installed = 1; + + if (getenv("AFL_QEMU_DEBUG_MAPS")) + print_mappings(); // if (!afl_area_ptr) return; // not necessary because of fixed dummy buffer |