Bump FRIDA version
MODIFY
frida_mode/GNUmakefile
frida_mode/GNUmakefile
@@ -57,7 +57,8 @@ ifdef DEBUG
CFLAGS+=-Werror \
-Wall \
-Wextra \
- -Wpointer-arith
+ -Wpointer-arith \
+ -Wno-unknown-pragmas
else
CFLAGS+=-Wno-pointer-arith
endif
@@ -142,7 +143,7 @@ ifndef OS
$(error "Operating system unsupported")
endif
-GUM_DEVKIT_VERSION=15.2.1
+GUM_DEVKIT_VERSION=15.2.2
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)"

MODIFY
frida_mode/src/ctx/ctx_arm32.c
frida_mode/src/ctx/ctx_arm32.c
gsize ctx_read_reg(GumArmCpuContext *ctx, arm_reg reg) {
+ UNUSED_PARAMETER(ctx);
+ UNUSED_PARAMETER(reg);
FFATAL("ctx_read_reg unimplemented for this architecture");
}

MODIFY
frida_mode/src/instrument/instrument_arm32.c
frida_mode/src/instrument/instrument_arm32.c
@@ -137,7 +137,7 @@ gboolean instrument_is_coverage_optimize_supported(void) {
static void instrument_coverage_switch(GumStalkerObserver *self,
gpointer from_address,
gpointer start_address,
- const cs_insn * from_insn,
+ void *from_insn,
gpointer *target) {
UNUSED_PARAMETER(self);
UNUSED_PARAMETER(from_address);
@@ -148,7 +148,7 @@ static void instrument_coverage_switch(GumStalkerObserver *self,
return;
}
- *target += G_STRUCT_OFFSET(afl_log_code_asm_t, str_r0_sp_rz);
+ *target = (guint8 *)*target + G_STRUCT_OFFSET(afl_log_code_asm_t, str_r0_sp_rz);
}
static void instrument_coverage_suppress_init(void) {
@@ -184,12 +184,9 @@ void instrument_coverage_optimize(const cs_insn *instr,
guint64 area_offset = instrument_get_offset_hash(GUM_ADDRESS(instr->address));
gsize map_size_pow2;
gsize area_offset_ror;
- GumAddress code_addr = 0;
instrument_coverage_suppress_init();
- code_addr = cw->pc;
-
block_start = GSIZE_TO_POINTER(GUM_ADDRESS(cw->code));
if (!g_hash_table_add(coverage_blocks, block_start)) {

MODIFY
frida_mode/src/instrument/instrument_arm64.c
frida_mode/src/instrument/instrument_arm64.c
@@ -156,26 +156,47 @@ static gboolean instrument_is_deterministic(const cs_insn *from_insn) {
}
+cs_insn *
+instrument_disassemble (gconstpointer address)
+{
+ csh capstone;
+ cs_insn * insn = NULL;
+
+ cs_open (CS_ARCH_ARM64, GUM_DEFAULT_CS_ENDIAN, &capstone);
+ cs_option (capstone, CS_OPT_DETAIL, CS_OPT_ON);
+
+ cs_disasm (capstone, address, 16, GPOINTER_TO_SIZE (address), 1, &insn);
+
+ cs_close (&capstone);
+
+ return insn;
+}
+
static void instrument_coverage_switch(GumStalkerObserver *self,
gpointer from_address,
gpointer start_address,
- const cs_insn *from_insn,
+ void *from_insn,
gpointer *target) {
UNUSED_PARAMETER(self);
UNUSED_PARAMETER(from_address);
UNUSED_PARAMETER(start_address);
+ cs_insn * insn = NULL;
+ gboolean deterministic = FALSE;
gsize fixup_offset;
if (!g_hash_table_contains(coverage_blocks, GSIZE_TO_POINTER(*target)) &&
- !g_hash_table_contains(coverage_blocks, GSIZE_TO_POINTER(*target + 4))) {
+ !g_hash_table_contains(coverage_blocks, GSIZE_TO_POINTER((guint8 *)*target + 4))) {
return;
}
- if (instrument_is_deterministic(from_insn)) { return; }
+ insn = instrument_disassemble (from_insn);
+ deterministic = instrument_is_deterministic(insn);
+ cs_free (insn, 1);
+ if (deterministic) { return; }
/*
* Since each block is prefixed with a restoration prologue, we need to be
@@ -208,7 +229,7 @@ static void instrument_coverage_switch(GumStalkerObserver *self,
*/
fixup_offset = GUM_RESTORATION_PROLOG_SIZE +
G_STRUCT_OFFSET(afl_log_code_asm_t, restoration_prolog);
- *target += fixup_offset;
+ *target = (guint8 *)*target + fixup_offset;
}

MODIFY
frida_mode/src/prefetch.c
frida_mode/src/prefetch.c
@@ -29,7 +29,6 @@ gboolean prefetch_enable = TRUE;
gboolean prefetch_backpatch = TRUE;
static prefetch_data_t *prefetch_data = NULL;
-static int prefetch_shm_id = -1;
static GHashTable *cant_prefetch = NULL;

MODIFY
frida_mode/src/stats/stats_arm32.c
frida_mode/src/stats/stats_arm32.c
@@ -13,6 +13,7 @@ void starts_arch_init(void) {
void stats_write_arch(stats_data_t *data) {
+ UNUSED_PARAMETER(data);
FFATAL("Stats not supported on this architecture");
}

Bump FRIDA version