about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2022-01-19 18:22:27 +0000
committerYour Name <you@example.com>2022-01-19 18:22:27 +0000
commit5b06078a41a7e312fbec5a63ef7753f76bcde8f1 (patch)
tree919fd6b7f49f24c64f7fed4f3024a38dbb240b57
parenta3cf7c1224da802d1bfbea95883a91dadb1551f0 (diff)
downloadafl++-5b06078a41a7e312fbec5a63ef7753f76bcde8f1.tar.gz
Changes to support variations in the mapsize
-rw-r--r--frida_mode/GNUmakefile2
-rw-r--r--frida_mode/src/instrument/instrument.c6
-rw-r--r--frida_mode/src/instrument/instrument_x64.c6
3 files changed, 5 insertions, 9 deletions
diff --git a/frida_mode/GNUmakefile b/frida_mode/GNUmakefile
index 254c82db..010c12d9 100644
--- a/frida_mode/GNUmakefile
+++ b/frida_mode/GNUmakefile
@@ -259,7 +259,7 @@ endif
 
 
 ############################## AFL #############################################
-$(AFL_COMPILER_RT_OBJ): $(AFL_COMPILER_RT_SRC)
+$(AFL_COMPILER_RT_OBJ): $(AFL_COMPILER_RT_SRC) $(ROOT)include/config.h
 	$(TARGET_CC) \
 		$(CFLAGS) \
 		$(AFL_CFLAGS) \
diff --git a/frida_mode/src/instrument/instrument.c b/frida_mode/src/instrument/instrument.c
index 46ed1a34..418b35e8 100644
--- a/frida_mode/src/instrument/instrument.c
+++ b/frida_mode/src/instrument/instrument.c
@@ -318,12 +318,6 @@ void instrument_init(void) {
 
   if (instrument_unique) { instrument_tracing = TRUE; }
 
-  if (__afl_map_size != 0x10000) {
-
-    FATAL("Bad map size: 0x%08x", __afl_map_size);
-
-  }
-
   transformer = gum_stalker_transformer_make_from_callback(
       instrument_basic_block, NULL, NULL);
 
diff --git a/frida_mode/src/instrument/instrument_x64.c b/frida_mode/src/instrument/instrument_x64.c
index 0ea4f7f0..217c8c9b 100644
--- a/frida_mode/src/instrument/instrument_x64.c
+++ b/frida_mode/src/instrument/instrument_x64.c
@@ -216,6 +216,8 @@ static gboolean instrument_coverage_find_low(const GumRangeDetails *details,
   static GumAddress last_limit = (64ULL << 10);
   gpointer *        address = (gpointer *)user_data;
 
+  last_limit = GUM_ALIGN_SIZE (last_limit, __afl_map_size);
+
   if ((details->range->base_address - last_limit) > __afl_map_size) {
 
     *address = GSIZE_TO_POINTER(last_limit);
@@ -235,7 +237,7 @@ static gboolean instrument_coverage_find_low(const GumRangeDetails *details,
    * current block ID.
    */
   last_limit = GUM_ALIGN_SIZE(
-      details->range->base_address + details->range->size, (64ULL << 10));
+      details->range->base_address + details->range->size, __afl_map_size);
   return TRUE;
 
 }
@@ -326,7 +328,7 @@ void instrument_coverage_optimize_init(void) {
   FVERBOSE("Low address: %p", low_address);
 
   if (low_address == 0 ||
-      GPOINTER_TO_SIZE(low_address) > ((2UL << 20) - __afl_map_size)) {
+      GPOINTER_TO_SIZE(low_address) > ((2UL << 30) - __afl_map_size)) {
 
     FATAL("Invalid low_address: %p", low_address);