about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2024-02-04 16:08:57 +0100
committervanhauser-thc <vh@thc.org>2024-02-04 16:08:57 +0100
commit34a3060b0fee900331decce0bae55d4caefafc01 (patch)
tree2fd696275b9bf72364e5116a5576ff410b4c01e5
parentc77709cdd9b50832ed537dfd65d30bc7ffa79e7b (diff)
downloadafl++-34a3060b0fee900331decce0bae55d4caefafc01.tar.gz
config __afl_cmplog_max_len
-rw-r--r--include/envs.h2
-rw-r--r--instrumentation/afl-compiler-rt.o.c9
2 files changed, 9 insertions, 2 deletions
diff --git a/include/envs.h b/include/envs.h
index 0f645d23..8f342553 100644
--- a/include/envs.h
+++ b/include/envs.h
@@ -21,7 +21,7 @@ static char *afl_environment_variables[] = {
     "AFL_BENCH_UNTIL_CRASH", "AFL_CAL_FAST", "AFL_CC", "AFL_CC_COMPILER",
     "AFL_CMIN_ALLOW_ANY", "AFL_CMIN_CRASHES_ONLY", "AFL_CMPLOG_ONLY_NEW",
     "AFL_CODE_END", "AFL_CODE_START", "AFL_COMPCOV_BINNAME",
-    "AFL_COMPCOV_LEVEL", "AFL_CRASH_EXITCODE",
+    "AFL_CMPLOG_MAX_LEN", "AFL_COMPCOV_LEVEL", "AFL_CRASH_EXITCODE",
     "AFL_CRASHING_SEEDS_AS_NEW_CRASH", "AFL_CUSTOM_MUTATOR_LIBRARY",
     "AFL_CUSTOM_MUTATOR_ONLY", "AFL_CUSTOM_INFO_PROGRAM",
     "AFL_CUSTOM_INFO_PROGRAM_ARGV", "AFL_CUSTOM_INFO_PROGRAM_INPUT",
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index a154bcf7..c4177b08 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -186,7 +186,7 @@ __thread u32        __afl_prev_ctx;
 struct cmp_map *__afl_cmp_map;
 struct cmp_map *__afl_cmp_map_backup;
 
-static u8 __afl_cmplog_max_len = 16;
+static u8 __afl_cmplog_max_len = 32;  // 16-32
 
 /* Child pid? */
 
@@ -738,6 +738,13 @@ static void __afl_map_shm(void) {
 
   }
 
+  if (getenv("AFL_CMPLOG_MAX_LEN")) {
+
+    int tmp = atoi(getenv("AFL_CMPLOG_MAX_LEN"));
+    if (tmp >= 16 && tmp <= 32) { __afl_cmplog_max_len = tmp; }
+
+  }
+
 }
 
 /* unmap SHM. */