From d3b3d10a91e0670d07136fd8b6adb71340716a9b Mon Sep 17 00:00:00 2001 From: Francesco Tamagni Date: Sun, 14 Jan 2024 12:02:50 +0100 Subject: [PATCH] interceptor: Cloak thunks on arm64 --- gum/backend-arm64/guminterceptor-arm64.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gum/backend-arm64/guminterceptor-arm64.c b/gum/backend-arm64/guminterceptor-arm64.c index 0912279d1..b97d3cae4 100644 --- a/gum/backend-arm64/guminterceptor-arm64.c +++ b/gum/backend-arm64/guminterceptor-arm64.c @@ -10,6 +10,7 @@ #include "gumarm64reader.h" #include "gumarm64relocator.h" #include "gumarm64writer.h" +#include "gumcloak.h" #include "gumlibc.h" #include "gummemory.h" #ifdef HAVE_DARWIN @@ -1012,11 +1013,17 @@ static void gum_interceptor_backend_create_thunks (GumInterceptorBackend * self) { gsize page_size, code_size; + GumMemoryRange range; page_size = gum_query_page_size (); code_size = page_size; self->thunks = gum_memory_allocate (NULL, code_size, page_size, GUM_PAGE_RW); + + range.base_address = GUM_ADDRESS (self->thunks); + range.size = code_size; + gum_cloak_add_range (&range); + gum_memory_patch_code (self->thunks, 1024, (GumMemoryPatchApplyFunc) gum_emit_thunks, self); }