about summary refs log tree commit diff
path: root/gcc_plugin/afl-gcc-rt.o.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc_plugin/afl-gcc-rt.o.c')
-rw-r--r--gcc_plugin/afl-gcc-rt.o.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc_plugin/afl-gcc-rt.o.c b/gcc_plugin/afl-gcc-rt.o.c
index b157b50f..0a2246e7 100644
--- a/gcc_plugin/afl-gcc-rt.o.c
+++ b/gcc_plugin/afl-gcc-rt.o.c
@@ -139,6 +139,7 @@ static void __afl_map_shm(void) {
 static void __afl_start_forkserver(void) {
 
   u8  tmp[4] = {0, 0, 0, 0};
+  u32 map_size = MAP_SIZE;
   s32 child_pid;
 
   u8 child_stopped = 0;
@@ -148,6 +149,13 @@ static void __afl_start_forkserver(void) {
   /* Phone home and tell the parent that we're OK. If parent isn't there,
      assume we're not running in forkserver mode and just execute program. */
 
+  if (MAP_SIZE <= 0x800000) {
+
+    map_size = (FS_OPT_ENABLED | FS_OPT_MAPSIZE | FS_OPT_SET_MAPSIZE(MAP_SIZE));
+    memcpy(tmp, &map_size, 4);
+
+  }
+
   if (write(FORKSRV_FD + 1, tmp, 4) != 4) return;
 
   while (1) {