about summary refs log tree commit diff
path: root/qemu_mode/patches/afl-qemu-cpu-inl.h
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-06 21:43:50 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-06 21:43:50 +0100
commite5972efa41c6371a6d1fed14492418ad0a756eae (patch)
tree8db5b5c8afc9e9b2bfd4f294b76e9fae11821320 /qemu_mode/patches/afl-qemu-cpu-inl.h
parent1ece4bb7dfc617dd03a9d416108aade97579a3c1 (diff)
downloadafl++-e5972efa41c6371a6d1fed14492418ad0a756eae.tar.gz
cmplog for qemu mode
Diffstat (limited to 'qemu_mode/patches/afl-qemu-cpu-inl.h')
-rw-r--r--qemu_mode/patches/afl-qemu-cpu-inl.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/qemu_mode/patches/afl-qemu-cpu-inl.h b/qemu_mode/patches/afl-qemu-cpu-inl.h
index ac847371..0ae6364b 100644
--- a/qemu_mode/patches/afl-qemu-cpu-inl.h
+++ b/qemu_mode/patches/afl-qemu-cpu-inl.h
@@ -32,11 +32,8 @@
  */
 
 #include <sys/shm.h>
-#include "../../config.h"
 #include "afl-qemu-common.h"
 
-#define PERSISTENT_DEFAULT_MAX_CNT 1000
-
 /***************************
  * VARIOUS AUXILIARY STUFF *
  ***************************/
@@ -81,6 +78,9 @@ u8 afl_compcov_level;
 
 __thread abi_ulong afl_prev_loc;
 
+struct cmp_map* __afl_cmp_map;
+__thread u32    __afl_cmp_counter;
+
 /* Set in the child process in forkserver mode: */
 
 static int forkserver_installed = 0;
@@ -181,6 +181,22 @@ static void afl_setup(void) {
     if (inst_r) afl_area_ptr[0] = 1;
 
   }
+  
+  if (getenv("___AFL_EINS_ZWEI_POLIZEI___")) { // CmpLog forkserver
+  
+    id_str = getenv(CMPLOG_SHM_ENV_VAR);
+
+    if (id_str) {
+
+      u32 shm_id = atoi(id_str);
+
+      __afl_cmp_map = shmat(shm_id, NULL, 0);
+
+      if (__afl_cmp_map == (void*)-1) _exit(1);
+
+    }
+    
+  }
 
   if (getenv("AFL_INST_LIBS")) {