Fixes to exclude ASAN DSO

This commit is contained in:
Your Name 2021-11-17 20:27:45 +00:00
parent 7514565858
commit 67a6481b36
5 changed files with 39 additions and 0 deletions

View File

@ -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

View File

@ -1,6 +1,7 @@
#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");
}

View File

@ -88,6 +88,8 @@ void asan_arch_init(void) {
}
asan_exclude_module_by_symbol("__asan_loadN");
}
#endif

View File

@ -85,6 +85,8 @@ void asan_arch_init(void) {
}
asan_exclude_module_by_symbol("__asan_loadN");
}
#endif

View File

@ -85,6 +85,8 @@ void asan_arch_init(void) {
}
asan_exclude_module_by_symbol("__asan_loadN");
}
#endif