qemu maps debug print
@@ -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) {
@@ -240,6 +255,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
pid_t child_pid;
