qemu maps debug print

This commit is contained in:
Andrea Fioraldi 2019-10-08 09:43:38 +02:00
parent 16551643b3
commit 78d9fa280c

View File

@ -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