diff options
-rw-r--r-- | frida_mode/GNUmakefile | 2 | ||||
-rw-r--r-- | frida_mode/src/instrument/instrument.c | 3 | ||||
-rw-r--r-- | frida_mode/src/instrument/instrument_arm64.c | 3 | ||||
-rw-r--r-- | frida_mode/src/instrument/instrument_x64.c | 9 | ||||
-rw-r--r-- | frida_mode/src/instrument/instrument_x86.c | 3 | ||||
-rw-r--r-- | frida_mode/src/intercept.c | 4 |
6 files changed, 13 insertions, 11 deletions
diff --git a/frida_mode/GNUmakefile b/frida_mode/GNUmakefile index b9b47b62..bc7df6c0 100644 --- a/frida_mode/GNUmakefile +++ b/frida_mode/GNUmakefile @@ -116,7 +116,7 @@ ifndef OS $(error "Operating system unsupported") endif -GUM_DEVKIT_VERSION=15.1.27 +GUM_DEVKIT_VERSION=15.2.1 GUM_DEVKIT_FILENAME=frida-gumjs-devkit-$(GUM_DEVKIT_VERSION)-$(OS)-$(ARCH).tar.xz GUM_DEVKIT_URL="https://github.com/frida/frida/releases/download/$(GUM_DEVKIT_VERSION)/$(GUM_DEVKIT_FILENAME)" diff --git a/frida_mode/src/instrument/instrument.c b/frida_mode/src/instrument/instrument.c index 9ee7db2d..a9568390 100644 --- a/frida_mode/src/instrument/instrument.c +++ b/frida_mode/src/instrument/instrument.c @@ -20,6 +20,8 @@ #include "stats.h" #include "util.h" +#define FRIDA_DEFAULT_MAP_SIZE (64UL << 10) + gboolean instrument_tracing = false; gboolean instrument_optimize = false; gboolean instrument_unique = false; @@ -289,6 +291,7 @@ void instrument_config(void) { } void instrument_init(void) { + if (__afl_map_size == MAP_SIZE) __afl_map_size = FRIDA_DEFAULT_MAP_SIZE; if (!instrument_is_coverage_optimize_supported()) instrument_optimize = false; diff --git a/frida_mode/src/instrument/instrument_arm64.c b/frida_mode/src/instrument/instrument_arm64.c index afc20f42..3c37ea5f 100644 --- a/frida_mode/src/instrument/instrument_arm64.c +++ b/frida_mode/src/instrument/instrument_arm64.c @@ -272,9 +272,10 @@ void instrument_coverage_optimize(const cs_insn *instr, GumAddressSpec spec = {.near_address = cw->code, .max_distance = 1ULL << 30}; + guint page_size = gum_query_page_size(); instrument_previous_pc_addr = gum_memory_allocate_near( - &spec, sizeof(guint64), 0x1000, GUM_PAGE_READ | GUM_PAGE_WRITE); + &spec, sizeof(guint64), page_size, GUM_PAGE_READ | GUM_PAGE_WRITE); *instrument_previous_pc_addr = instrument_hash_zero; FVERBOSE("instrument_previous_pc_addr: %p", instrument_previous_pc_addr); FVERBOSE("code_addr: %p", cw->code); diff --git a/frida_mode/src/instrument/instrument_x64.c b/frida_mode/src/instrument/instrument_x64.c index bfafe067..687b2e40 100644 --- a/frida_mode/src/instrument/instrument_x64.c +++ b/frida_mode/src/instrument/instrument_x64.c @@ -333,19 +333,17 @@ static void instrument_coverage_write(GumAddress address, } -void instrument_coverage_optimize(const cs_insn *instr, +void instrument_coverage_optimize(const cs_insn * instr, GumStalkerOutput *output) { - GumX86Writer *cw = output->writer.x86; - /* guint64 area_offset = - * instrument_get_offset_hash(GUM_ADDRESS(instr->address)); */ if (instrument_previous_pc_addr == NULL) { GumAddressSpec spec = {.near_address = cw->code, .max_distance = 1ULL << 30}; + guint page_size = gum_query_page_size(); instrument_previous_pc_addr = gum_memory_allocate_near( - &spec, sizeof(guint64), 0x1000, GUM_PAGE_READ | GUM_PAGE_WRITE); + &spec, sizeof(guint64), page_size, GUM_PAGE_READ | GUM_PAGE_WRITE); *instrument_previous_pc_addr = instrument_hash_zero; FVERBOSE("instrument_previous_pc_addr: %p", instrument_previous_pc_addr); FVERBOSE("code_addr: %p", cw->code); @@ -361,7 +359,6 @@ void instrument_coverage_optimize(const cs_insn *instr, } instrument_coverage_write(GUM_ADDRESS(instr->address), output); - } void instrument_coverage_optimize_insn(const cs_insn *instr, diff --git a/frida_mode/src/instrument/instrument_x86.c b/frida_mode/src/instrument/instrument_x86.c index 048daf32..8798cfcf 100644 --- a/frida_mode/src/instrument/instrument_x86.c +++ b/frida_mode/src/instrument/instrument_x86.c @@ -162,9 +162,10 @@ void instrument_coverage_optimize(const cs_insn *instr, GumAddressSpec spec = {.near_address = cw->code, .max_distance = 1ULL << 30}; + guint page_size = gum_query_page_size(); instrument_previous_pc_addr = gum_memory_allocate_near( - &spec, sizeof(guint64), 0x1000, GUM_PAGE_READ | GUM_PAGE_WRITE); + &spec, sizeof(guint64), page_size, GUM_PAGE_READ | GUM_PAGE_WRITE); *instrument_previous_pc_addr = instrument_hash_zero; FVERBOSE("instrument_previous_pc_addr: %p", instrument_previous_pc_addr); FVERBOSE("code_addr: %p", cw->code); diff --git a/frida_mode/src/intercept.c b/frida_mode/src/intercept.c index 26d20c50..e9751848 100644 --- a/frida_mode/src/intercept.c +++ b/frida_mode/src/intercept.c @@ -7,8 +7,8 @@ void intercept_hook(void *address, gpointer replacement, gpointer user_data) { GumInterceptor *interceptor = gum_interceptor_obtain(); gum_interceptor_begin_transaction(interceptor); - GumReplaceReturn ret = - gum_interceptor_replace(interceptor, address, replacement, user_data); + GumReplaceReturn ret = gum_interceptor_replace(interceptor, address, + replacement, user_data, NULL); if (ret != GUM_REPLACE_OK) { FFATAL("gum_interceptor_attach: %d", ret); } gum_interceptor_end_transaction(interceptor); |