about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/afl-fuzz.h13
-rw-r--r--include/common.h2
-rw-r--r--include/config.h9
-rw-r--r--include/types.h27
4 files changed, 34 insertions, 17 deletions
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h
index 428bfa8e..2203cfdf 100644
--- a/include/afl-fuzz.h
+++ b/include/afl-fuzz.h
@@ -614,11 +614,6 @@ typedef struct afl_state {
 
 } afl_state_t;
 
-/* A global pointer to all instances is needed (for now) for signals to arrive
- */
-
-extern list_t afl_states;
-
 struct custom_mutator {
 
   const char *name;
@@ -800,6 +795,14 @@ struct custom_mutator {
 
 void afl_state_init(afl_state_t *, uint32_t map_size);
 void afl_state_deinit(afl_state_t *);
+
+/* Set stop_soon flag on all childs, kill all childs */
+void afl_states_stop(void);
+/* Set clear_screen flag on all states */
+void afl_states_clear_screen(void);
+/* Sets the skip flag on all states */
+void afl_states_request_skip(void);
+
 void read_afl_environment(afl_state_t *, char **);
 
 /**** Prototypes ****/
diff --git a/include/common.h b/include/common.h
index 70ff0744..4aed9572 100644
--- a/include/common.h
+++ b/include/common.h
@@ -115,7 +115,7 @@ u8 *u_stringify_time_diff(u8 *buf, u64 cur_ms, u64 event_ms);
 u32 read_timed(s32 fd, void *buf, size_t len, u32 timeout_ms,
                volatile u8 *stop_soon_p);
 
-u32 get_map_size();
+u32 get_map_size(void);
 
 #endif
 
diff --git a/include/config.h b/include/config.h
index f11ac919..c21d775a 100644
--- a/include/config.h
+++ b/include/config.h
@@ -400,14 +400,5 @@
 #endif
 #endif                           /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */
 
-/* Extended forkserver option values */
-
-#define FS_OPT_ENABLED 0x8f000001
-#define FS_OPT_MAPSIZE 0x40000000
-#define FS_OPT_SNAPSHOT 0x20000000
-#define FS_OPT_AUTODICT 0x10000000
-#define FS_OPT_GET_MAPSIZE(x) (((x & 0x00fffffe) >> 1) + 1)
-#define FS_OPT_SET_MAPSIZE(x) (x <= 1 || x > 0x1000000 ? 0 : ((x - 1) << 1))
-
 #endif                                                  /* ! _HAVE_CONFIG_H */
 
diff --git a/include/types.h b/include/types.h
index f2a12953..e7ff131d 100644
--- a/include/types.h
+++ b/include/types.h
@@ -30,6 +30,29 @@ typedef uint8_t  u8;
 typedef uint16_t u16;
 typedef uint32_t u32;
 
+/* Extended forkserver option values */
+
+/* Reporting errors */
+#define FS_OPT_ERROR 0xf800008f
+#define FS_OPT_GET_ERROR(x) ((x & 0x00ffff00) >> 8)
+#define FS_OPT_SET_ERROR(x) ((x & 0x0000ffff) << 8)
+#define FS_ERROR_MAP_SIZE 1
+#define FS_ERROR_MAP_ADDR 2
+#define FS_ERROR_SHM_OPEN 4
+#define FS_ERROR_SHMAT 8
+#define FS_ERROR_MMAP 16
+
+/* Reporting options */
+#define FS_OPT_ENABLED 0x8f000001
+#define FS_OPT_MAPSIZE 0x40000000
+#define FS_OPT_SNAPSHOT 0x20000000
+#define FS_OPT_AUTODICT 0x10000000
+// FS_OPT_MAX_MAPSIZE is 8388608 = 0x800000 = 2^23 = 1 << 22
+#define FS_OPT_MAX_MAPSIZE ((0x00fffffe >> 1) + 1)
+#define FS_OPT_GET_MAPSIZE(x) (((x & 0x00fffffe) >> 1) + 1)
+#define FS_OPT_SET_MAPSIZE(x) \
+  (x <= 1 || x > FS_OPT_MAX_MAPSIZE ? 0 : ((x - 1) << 1))
+
 /*
 
    Ugh. There is an unintended compiler / glibc #include glitch caused by
@@ -108,7 +131,7 @@ typedef int64_t s64;
   })
 
 #ifdef AFL_LLVM_PASS
-#if defined(__linux__)
+#if defined(__linux__) || !defined(__ANDROID__)
 #define AFL_SR(s) (srandom(s))
 #define AFL_R(x) (random() % (x))
 #else
@@ -116,7 +139,7 @@ typedef int64_t s64;
 #define AFL_R(x) (arc4random_uniform(x))
 #endif
 #else
-#if defined(__linux__)
+#if defined(__linux__) || !defined(__ANDROID__)
 #define SR(s) (srandom(s))
 #define R(x) (random() % (x))
 #else