about summary refs log tree commit diff
path: root/include/forkserver.h
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-03-09 11:24:10 +0100
committerGitHub <noreply@github.com>2020-03-09 11:24:10 +0100
commitdba3595c0ae26795a78753ea33ff0c3edf9d6328 (patch)
tree03bcaf132705d6de222ef8d6eff9b5bc2f03ce54 /include/forkserver.h
parentc159b872ef17d4c09238f99ac11021e12975cb3a (diff)
downloadafl++-dba3595c0ae26795a78753ea33ff0c3edf9d6328.tar.gz
AFL without globals (#220)
* moved globals to afl, shm and fsrv 

* moved argv to afl state, less bugs

* fixed unicorn docu

* lists everywhere

* merged custom mutators

* fixed leaks in afl-fuzz
Diffstat (limited to 'include/forkserver.h')
-rw-r--r--include/forkserver.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/include/forkserver.h b/include/forkserver.h
index 0fdcba48..3587427b 100644
--- a/include/forkserver.h
+++ b/include/forkserver.h
@@ -27,8 +27,47 @@
 #ifndef __AFL_FORKSERVER_H
 #define __AFL_FORKSERVER_H
 
+#include <stdio.h>
+
+typedef struct afl_forkserver {
+
+  /* a program that includes afl-forkserver needs to define these */
+
+  u8 uses_asan;                  /* Target uses ASAN?                */
+  u8* trace_bits;                /* SHM with instrumentation bitmap  */
+  u8 use_stdin;                  /* use stdin for sending data       */
+
+s32 fsrv_pid,                 /* PID of the fork server           */
+    child_pid,                   /* PID of the fuzzed program        */
+    out_dir_fd;                  /* FD of the lock file              */
+
+s32 out_fd,                      /* Persistent fd for afl->fsrv.out_file       */
+#ifndef HAVE_ARC4RANDOM
+    dev_urandom_fd,              /* Persistent fd for /dev/urandom   */
+#endif
+    dev_null_fd,                 /* Persistent fd for /dev/null      */
+    fsrv_ctl_fd,                 /* Fork server control pipe (write) */
+    fsrv_st_fd;                  /* Fork server status pipe (read)   */
+
+  u32 exec_tmout;                  /* Configurable exec timeout (ms)   */
+  u64 mem_limit;                   /* Memory cap for child (MB)        */
+
+  u8 *out_file,                    /* File to fuzz, if any             */
+     *target_path;                 /* Path of the target */
+
+  FILE* plot_file;                 /* Gnuplot output file              */
+
+  u8  child_timed_out;             /* Traced process timed out?        */
+
+} afl_forkserver_t;
+
+
+
 void handle_timeout(int sig);
-void init_forkserver(char **argv);
+void afl_fsrv_init(afl_forkserver_t *fsrv);
+void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv);
+void afl_fsrv_deinit(afl_forkserver_t *fsrv);
+void afl_fsrv_killall();
 
 #ifdef __APPLE__
 #define MSG_FORK_ON_APPLE                                                    \