Fixes to exclude ASAN DSO
MODIFY
frida_mode/include/asan.h
frida_mode/include/asan.h
@@ -9,6 +9,7 @@ void asan_config(void);
void asan_init(void);
void asan_arch_init(void);
void asan_instrument(const cs_insn *instr, GumStalkerIterator *iterator);
+void asan_exclude_module_by_symbol(gchar *symbol_name);
#endif

MODIFY
frida_mode/src/asan/asan.c
frida_mode/src/asan/asan.c
#include "frida-gumjs.h"
#include "asan.h"
+#include "ranges.h"
#include "util.h"
static gboolean asan_enabled = FALSE;
@@ -32,3 +33,34 @@ void asan_init(void) {
}
+gboolean asan_exclude_range(const GumRangeDetails *details,
+ gpointer user_data) {
+
+ UNUSED_PARAMETER(user_data);
+
+ FOKF("Exclude ASAN: 0x%016lx-0x%016lx", details->range->base_address,
+ details->range->base_address + details->range->size);
+
+ ranges_add_exclude((GumMemoryRange *)details->range);
+
+}
+
+static gboolean asan_exclude_module(const GumModuleDetails *details,
+ gpointer user_data) {
+
+ gchar * symbol_name = (gchar *)user_data;
+ GumAddress address;
+
+ address = gum_module_find_export_by_name(details->name, symbol_name);
+ if (address == 0) { return TRUE; }
+
+ gum_process_enumerate_ranges(GUM_PAGE_NO_ACCESS, asan_exclude_range, NULL);
+
+}
+
+void asan_exclude_module_by_symbol(gchar *symbol_name) {
+
+ gum_process_enumerate_modules(asan_exclude_module, "__asan_loadN");
+
+}
+

MODIFY
frida_mode/src/asan/asan_arm64.c
frida_mode/src/asan/asan_arm64.c
@@ -88,6 +88,8 @@ void asan_arch_init(void) {
}
+ asan_exclude_module_by_symbol("__asan_loadN");
+
}
#endif

MODIFY
frida_mode/src/asan/asan_x64.c
frida_mode/src/asan/asan_x64.c
@@ -85,6 +85,8 @@ void asan_arch_init(void) {
}
+ asan_exclude_module_by_symbol("__asan_loadN");
+
}
#endif

MODIFY
frida_mode/src/asan/asan_x86.c
frida_mode/src/asan/asan_x86.c
@@ -85,6 +85,8 @@ void asan_arch_init(void) {
}
+ asan_exclude_module_by_symbol("__asan_loadN");
+
}
#endif

Fixes to exclude ASAN DSO