about summary refs log tree commit diff
path: root/qemu_mode/patches/afl-qemu-cpu-inl.h
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-04-11 08:15:42 +0200
committervan Hauser <vh@thc.org>2020-04-11 08:15:42 +0200
commitd8947d1fa41c8fa12b2bf6a0ef128bd1d06b127e (patch)
tree87e2173f7157b4715059c5dfcdbf2d6a891abbc7 /qemu_mode/patches/afl-qemu-cpu-inl.h
parent32ba60185eba8a3ae8eeba0b5830d1bb43e38473 (diff)
downloadafl++-d8947d1fa41c8fa12b2bf6a0ef128bd1d06b127e.tar.gz
add extended forkserver feature to gcc_plugin and qemu_mode
Diffstat (limited to 'qemu_mode/patches/afl-qemu-cpu-inl.h')
-rw-r--r--qemu_mode/patches/afl-qemu-cpu-inl.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/qemu_mode/patches/afl-qemu-cpu-inl.h b/qemu_mode/patches/afl-qemu-cpu-inl.h
index d73566fc..ee3ec44e 100644
--- a/qemu_mode/patches/afl-qemu-cpu-inl.h
+++ b/qemu_mode/patches/afl-qemu-cpu-inl.h
@@ -293,6 +293,7 @@ static void print_mappings(void) {
 
 void afl_forkserver(CPUState *cpu) {
 
+  u32                  map_size = 0;
   static unsigned char tmp[4] = {0, 0, 0, 0};
 
   if (forkserver_installed == 1) return;
@@ -306,6 +307,15 @@ void afl_forkserver(CPUState *cpu) {
   int   t_fd[2];
   u8    child_stopped = 0;
 
+  // if in the future qemu has non-collding coverage then switch MAP_SIZE
+  // with the max ID value
+  if (MAP_SIZE <= 0x800000) {
+
+    map_size = (FS_OPT_ENABLED | FS_OPT_MAPSIZE | FS_OPT_SET_MAPSIZE(MAP_SIZE));
+    memcpy(tmp, &map_size, 4);
+
+  }
+
   /* Tell the parent that we're alive. If the parent doesn't want
      to talk, assume that we're not running in forkserver mode. */