about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergej Schumilo <sergej@schumilo.de>2023-08-03 14:40:10 +0200
committerSergej Schumilo <sergej@schumilo.de>2023-08-03 14:40:10 +0200
commit8f31086a7fa1d7ef9d4dc416f238a10dd140e2d3 (patch)
treec017e2385efb966b3d35981e348ead0e96c7d3ba
parent641c551ba05bcd602bd351cb705b14cd652e0dda (diff)
downloadafl++-8f31086a7fa1d7ef9d4dc416f238a10dd140e2d3.tar.gz
make nyx aux buffer size configurable
-rw-r--r--include/envs.h1
-rw-r--r--include/forkserver.h1
-rw-r--r--src/afl-forkserver.c10
-rw-r--r--src/afl-fuzz.c3
4 files changed, 15 insertions, 0 deletions
diff --git a/include/envs.h b/include/envs.h
index edfd06e4..0ef331ae 100644
--- a/include/envs.h
+++ b/include/envs.h
@@ -189,6 +189,7 @@ static char *afl_environment_variables[] = {
     "AFL_MAX_DET_EXTRAS",
     "AFL_NO_X86",  // not really an env but we dont want to warn on it
     "AFL_NOOPT",
+    "AFL_NYX_AUX_SIZE",
     "AFL_PASSTHROUGH",
     "AFL_PATH",
     "AFL_PERFORMANCE_FILE",
diff --git a/include/forkserver.h b/include/forkserver.h
index f5069ce2..c93c6f61 100644
--- a/include/forkserver.h
+++ b/include/forkserver.h
@@ -86,6 +86,7 @@ typedef struct {
                                  uint32_t size);
 
   bool (*nyx_remove_work_dir)(const char *workdir);
+  bool (*nyx_config_set_aux_buffer_size)(void *config, uint32_t aux_buffer_size);
 
 } nyx_plugin_handler_t;
 
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index ba7cdd66..957cb2b7 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -129,6 +129,9 @@ nyx_plugin_handler_t *afl_load_libnyx_plugin(u8 *libnyx_binary) {
   plugin->nyx_remove_work_dir = dlsym(handle, "nyx_remove_work_dir");
   if (plugin->nyx_remove_work_dir == NULL) { goto fail; }
 
+  plugin->nyx_config_set_aux_buffer_size = dlsym(handle, "nyx_config_set_aux_buffer_size");
+  if (plugin->nyx_config_set_aux_buffer_size == NULL) { goto fail; }
+
   OKF("libnyx plugin is ready!");
   return plugin;
 
@@ -589,6 +592,13 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
 
     }
 
+    if (getenv("AFL_NYX_AUX_SIZE") != NULL) {
+        if(fsrv->nyx_handlers->nyx_config_set_aux_buffer_size(
+            nyx_config, atoi(getenv("AFL_NYX_AUX_SIZE"))) != 1) {  
+            NYX_PRE_FATAL(fsrv, "Invalid AFL_NYX_AUX_SIZE value set (must be a multiple of 4096) ...");
+        }
+    }
+
     if (getenv("NYX_REUSE_SNAPSHOT") != NULL) {
 
       if (access(getenv("NYX_REUSE_SNAPSHOT"), F_OK) == -1) {
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index bacbafc4..9504d908 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -299,6 +299,9 @@ static void usage(u8 *argv0, int more_help) {
       "AFL_NO_SNAPSHOT: do not use the snapshot feature (if the snapshot lkm is loaded)\n"
       "AFL_NO_STARTUP_CALIBRATION: no initial seed calibration, start fuzzing at once\n"
       "AFL_NO_UI: switch status screen off\n"
+      "AFL_NYX_AUX_SIZE: size of the Nyx auxiliary buffer. Must be a multiple of 4096.\n"
+      "                  Increase this value in case the crash reports are truncated.\n"
+      "                  Default value is 4096.\n"
 
       DYN_COLOR