From 95394935cd2da8a24f7013641c8cd994edbcb705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Mon, 6 Jan 2025 01:09:07 +0100 Subject: [PATCH] Port to the new Gum.Module API --- lib/agent/agent.vala | 31 +++++++++++----------- lib/payload/cloak.vala | 35 ++++++++++++++----------- lib/payload/exit-monitor.vala | 7 ++--- lib/payload/fd-guard.vala | 2 +- lib/payload/fork-monitor.vala | 26 +++++++++++------- lib/payload/spawn-monitor.vala | 27 ++++++++++--------- lib/payload/thread-suspend-monitor.vala | 7 ++--- lib/payload/unwind-sitter-glue.c | 16 ++++++++--- lib/payload/unwind-sitter.vala | 2 +- src/darwin/frida-helper-backend-glue.m | 14 +++++----- src/linux/frida-helper-backend.vala | 13 +++++---- src/linux/system-linux.c | 2 +- tests/test-host-session.vala | 2 +- 13 files changed, 104 insertions(+), 80 deletions(-) diff --git a/lib/agent/agent.vala b/lib/agent/agent.vala index 1c5b1b4f3..62786a947 100644 --- a/lib/agent/agent.vala +++ b/lib/agent/agent.vala @@ -1509,13 +1509,14 @@ namespace Frida.Agent { } public static NativeBridgeApi open () throws Error { - string? nb_mod = null; - string? vm_mod = null; - Gum.Process.enumerate_modules ((details) => { - if (/\/lib(64)?\/libnativebridge.so$/.match (details.path)) - nb_mod = details.path; - else if (/^lib(art|dvm).so$/.match (details.name) && !/\/system\/fake-libs/.match (details.path)) - vm_mod = details.path; + Gum.Module? nb_mod = null; + Gum.Module? vm_mod = null; + Gum.Process.enumerate_modules (module => { + unowned string path = module.path; + if (/\/lib(64)?\/libnativebridge.so$/.match (path)) + nb_mod = module; + else if (/^lib(art|dvm).so$/.match (module.name) && !/\/system\/fake-libs/.match (path)) + vm_mod = module; bool carry_on = nb_mod == null || vm_mod == null; return carry_on; }); @@ -1530,29 +1531,27 @@ namespace Frida.Agent { NBUnloadLibraryFunc? unload; NBGetTrampolineFunc get_trampoline; - load = (NBLoadLibraryFunc) Gum.Module.find_export_by_name (nb_mod, "NativeBridgeLoadLibrary");; + load = (NBLoadLibraryFunc) nb_mod.find_export_by_name ("NativeBridgeLoadLibrary");; if (load != null) { flavor = MODERN; - load_ext = (NBLoadLibraryExtFunc) Gum.Module.find_export_by_name (nb_mod, "NativeBridgeLoadLibraryExt"); + load_ext = (NBLoadLibraryExtFunc) nb_mod.find_export_by_name ("NativeBridgeLoadLibraryExt"); // XXX: NativeBridgeUnloadLibrary() is only a stub as of Android 11 w/ libndk_translation.so unload = null; - get_trampoline = (NBGetTrampolineFunc) Gum.Module.find_export_by_name (nb_mod, - "NativeBridgeGetTrampoline"); + get_trampoline = (NBGetTrampolineFunc) nb_mod.find_export_by_name ("NativeBridgeGetTrampoline"); } else { flavor = LEGACY; - load = (NBLoadLibraryFunc) Gum.Module.find_export_by_name (nb_mod, - "_ZN7android23NativeBridgeLoadLibraryEPKci"); - load_ext = (NBLoadLibraryExtFunc) Gum.Module.find_export_by_name (nb_mod, + load = (NBLoadLibraryFunc) nb_mod.find_export_by_name ("_ZN7android23NativeBridgeLoadLibraryEPKci"); + load_ext = (NBLoadLibraryExtFunc) nb_mod.find_export_by_name ( "_ZN7android26NativeBridgeLoadLibraryExtEPKciPNS_25native_bridge_namespace_tE"); // XXX: Unload implementation seems to be unreliable. unload = null; - get_trampoline = (NBGetTrampolineFunc) Gum.Module.find_export_by_name (nb_mod, + get_trampoline = (NBGetTrampolineFunc) nb_mod.find_export_by_name ( "_ZN7android25NativeBridgeGetTrampolineEPvPKcS2_j"); } if (load == null || get_trampoline == null) throw new Error.NOT_SUPPORTED ("NativeBridge API is not available on this system"); - var get_vms = (JNIGetCreatedJavaVMsFunc) Gum.Module.find_export_by_name (vm_mod, "JNI_GetCreatedJavaVMs"); + var get_vms = (JNIGetCreatedJavaVMsFunc) vm_mod.find_export_by_name ("JNI_GetCreatedJavaVMs"); if (get_vms == null) throw new Error.NOT_SUPPORTED ("Unable to locate Java VM"); diff --git a/lib/payload/cloak.vala b/lib/payload/cloak.vala index f0ca3f5e4..6f8af5395 100644 --- a/lib/payload/cloak.vala +++ b/lib/payload/cloak.vala @@ -53,15 +53,18 @@ namespace Frida { private delegate ssize_t ReadFunc (int fd, void * buf, size_t count); construct { - Gum.Module.enumerate_imports ("libart.so", imp => { - if (imp.name == "read") { - read_slot = (ReadFunc *) imp.slot; - return false; - } - return true; - }); - if (read_slot != null) - old_read_impl = update_read_slot (on_read); + var art = Gum.Process.find_module_by_name ("libart.so"); + if (art != null) { + art.enumerate_imports (imp => { + if (imp.name == "read") { + read_slot = (ReadFunc *) imp.slot; + return false; + } + return true; + }); + if (read_slot != null) + old_read_impl = update_read_slot (on_read); + } } ~ThreadCountCloaker () { @@ -212,34 +215,34 @@ namespace Frida { construct { var interceptor = Gum.Interceptor.obtain (); - unowned string libc = Gum.Process.query_libc_name (); + var libc = Gum.Process.get_libc_module (); var open_listener = new OpenDirListener (this); listeners.add (open_listener); - interceptor.attach ((void *) Gum.Module.find_export_by_name (libc, "opendir"), open_listener); + interceptor.attach ((void *) libc.find_export_by_name ("opendir"), open_listener); var close_listener = new CloseDirListener (this); listeners.add (close_listener); - interceptor.attach ((void *) Gum.Module.find_export_by_name (libc, "closedir"), close_listener); + interceptor.attach ((void *) libc.find_export_by_name ("closedir"), close_listener); - var readdir_impl = Gum.Module.find_export_by_name (libc, "readdir"); + var readdir_impl = libc.find_export_by_name ("readdir"); var readdir_listener = new ReadDirListener (this, LEGACY); listeners.add (readdir_listener); interceptor.attach ((void *) readdir_impl, readdir_listener); - var readdir64_impl = Gum.Module.find_export_by_name (libc, "readdir64"); + var readdir64_impl = libc.find_export_by_name ("readdir64"); if (readdir64_impl != 0 && readdir64_impl != readdir_impl) { var listener = new ReadDirListener (this, MODERN); listeners.add (listener); interceptor.attach ((void *) readdir64_impl, listener); } - var readdir_r_impl = Gum.Module.find_export_by_name (libc, "readdir_r"); + var readdir_r_impl = libc.find_export_by_name ("readdir_r"); var readdir_r_listener = new ReadDirRListener (this, LEGACY); listeners.add (readdir_r_listener); interceptor.attach ((void *) readdir_r_impl, readdir_r_listener); - var readdir64_r_impl = Gum.Module.find_export_by_name (libc, "readdir64_r"); + var readdir64_r_impl = libc.find_export_by_name ("readdir64_r"); if (readdir64_r_impl != 0 && readdir64_r_impl != readdir_r_impl) { var listener = new ReadDirRListener (this, MODERN); listeners.add (listener); diff --git a/lib/payload/exit-monitor.vala b/lib/payload/exit-monitor.vala index 43afe8362..2bd7118a0 100644 --- a/lib/payload/exit-monitor.vala +++ b/lib/payload/exit-monitor.vala @@ -32,16 +32,17 @@ namespace Frida { unowned Gum.InvocationListener listener = this; #if WINDOWS - interceptor.attach ((void *) Gum.Module.find_export_by_name ("kernel32.dll", "ExitProcess"), listener); + interceptor.attach ((void *) Gum.Process.find_module_by_name ("kernel32.dll").find_export_by_name ("ExitProcess"), + listener); #else - unowned string libc = Gum.Process.query_libc_name (); + var libc = Gum.Process.get_libc_module (); const string[] apis = { "exit", "_exit", "abort", }; foreach (var symbol in apis) { - interceptor.attach ((void *) Gum.Module.find_export_by_name (libc, symbol), listener); + interceptor.attach ((void *) libc.find_export_by_name (symbol), listener); } #endif } diff --git a/lib/payload/fd-guard.vala b/lib/payload/fd-guard.vala index 81c9b3eeb..997cfc11d 100644 --- a/lib/payload/fd-guard.vala +++ b/lib/payload/fd-guard.vala @@ -26,7 +26,7 @@ namespace Frida { construct { var interceptor = Gum.Interceptor.obtain (); - var close = Gum.Module.find_export_by_name (Gum.Process.query_libc_name (), "close"); + var close = Gum.Process.get_libc_module ().find_export_by_name ("close"); close_listener = new CloseListener (this); interceptor.attach ((void *) close, close_listener); } diff --git a/lib/payload/fork-monitor.vala b/lib/payload/fork-monitor.vala index c350be6b7..fc9604efe 100644 --- a/lib/payload/fork-monitor.vala +++ b/lib/payload/fork-monitor.vala @@ -45,9 +45,9 @@ namespace Frida { } static construct { - unowned string libc = Gum.Process.query_libc_name (); - fork_impl = (void *) Gum.Module.find_export_by_name (libc, "fork"); - vfork_impl = (void *) Gum.Module.find_export_by_name (libc, "vfork"); + var libc = Gum.Process.get_libc_module (); + fork_impl = (void *) libc.find_export_by_name ("fork"); + vfork_impl = (void *) libc.find_export_by_name ("vfork"); } construct { @@ -61,15 +61,21 @@ namespace Frida { string cmdline; FileUtils.get_contents ("/proc/self/cmdline", out cmdline); if (cmdline == "zygote" || cmdline == "zygote64" || cmdline == "usap32" || cmdline == "usap64") { - var set_argv0 = (void *) Gum.Module.find_export_by_name ("libandroid_runtime.so", "_Z27android_os_Process_setArgV0P7_JNIEnvP8_jobjectP8_jstring"); - if (set_argv0 != null) { - interceptor.attach (set_argv0, listener, (void *) HookId.SET_ARGV0); - child_recovery_behavior = DEFERRED_UNTIL_SET_ARGV0; + var runtime = Gum.Process.find_module_by_name ("libandroid_runtime.so"); + if (runtime != null) { + var set_argv0 = (void *) runtime.find_export_by_name ("_Z27android_os_Process_setArgV0P7_JNIEnvP8_jobjectP8_jstring"); + if (set_argv0 != null) { + interceptor.attach (set_argv0, listener, (void *) HookId.SET_ARGV0); + child_recovery_behavior = DEFERRED_UNTIL_SET_ARGV0; + } } - var setcontext = (void *) Gum.Module.find_export_by_name ("libselinux.so", "selinux_android_setcontext"); - if (setcontext != null) - interceptor.attach (setcontext, listener, (void *) HookId.SET_CTX); + var selinux = Gum.Process.find_module_by_name ("libselinux.so"); + if (selinux != null) { + var setcontext = (void *) selinux.find_export_by_name ("selinux_android_setcontext"); + if (setcontext != null) + interceptor.attach (setcontext, listener, (void *) HookId.SET_CTX); + } } } catch (FileError e) { } diff --git a/lib/payload/spawn-monitor.vala b/lib/payload/spawn-monitor.vala index f5efd585e..2d6bb23b8 100644 --- a/lib/payload/spawn-monitor.vala +++ b/lib/payload/spawn-monitor.vala @@ -38,21 +38,24 @@ namespace Frida { var interceptor = Gum.Interceptor.obtain (); #if WINDOWS - var create_process_internal = Gum.Module.find_export_by_name ("kernelbase.dll", "CreateProcessInternalW"); - if (create_process_internal == 0) - create_process_internal = Gum.Module.find_export_by_name ("kernel32.dll", "CreateProcessInternalW"); + var kernelbase = Gum.Process.find_module_by_name ("kernelbase.dll"); + var create_process_internal = (kernelbase != null) ? kernelbase.find_export_by_name ("CreateProcessInternalW") : 0; + if (create_process_internal == 0) { + create_process_internal = Gum.Process.find_module_by_name ("kernel32.dll") + .find_export_by_name ("CreateProcessInternalW"); + } assert (create_process_internal != 0); interceptor.attach ((void *) create_process_internal, this); #else - unowned string libc = Gum.Process.query_libc_name (); + var libc = Gum.Process.get_libc_module (); #if DARWIN - posix_spawn = (PosixSpawnFunc) Gum.Module.find_export_by_name (libc, "posix_spawn"); - posix_spawnattr_init = (PosixSpawnAttrInitFunc) Gum.Module.find_export_by_name (libc, "posix_spawnattr_init"); - posix_spawnattr_destroy = (PosixSpawnAttrDestroyFunc) Gum.Module.find_export_by_name (libc, "posix_spawnattr_destroy"); - posix_spawnattr_getflags = (PosixSpawnAttrSetFlagsFunc) Gum.Module.find_export_by_name (libc, "posix_spawnattr_getflags"); - posix_spawnattr_setflags = (PosixSpawnAttrSetFlagsFunc) Gum.Module.find_export_by_name (libc, "posix_spawnattr_setflags"); + posix_spawn = (PosixSpawnFunc) libc.find_export_by_name ("posix_spawn"); + posix_spawnattr_init = (PosixSpawnAttrInitFunc) libc.find_export_by_name ("posix_spawnattr_init"); + posix_spawnattr_destroy = (PosixSpawnAttrDestroyFunc) libc.find_export_by_name ("posix_spawnattr_destroy"); + posix_spawnattr_getflags = (PosixSpawnAttrSetFlagsFunc) libc.find_export_by_name ("posix_spawnattr_getflags"); + posix_spawnattr_setflags = (PosixSpawnAttrSetFlagsFunc) libc.find_export_by_name ("posix_spawnattr_setflags"); - execve = (void *) Gum.Module.find_export_by_name (libc, "execve"); + execve = (void *) libc.find_export_by_name ("execve"); interceptor.attach ((void *) posix_spawn, this); @@ -60,10 +63,10 @@ namespace Frida { #else Gum.Address execve = 0; #if ANDROID - execve = Gum.Module.find_symbol_by_name (libc, "__execve"); + execve = libc.find_symbol_by_name ("__execve"); #endif if (execve == 0) - execve = Gum.Module.find_export_by_name (libc, "execve"); + execve = libc.find_export_by_name ("execve"); interceptor.attach ((void *) execve, this); #endif #endif diff --git a/lib/payload/thread-suspend-monitor.vala b/lib/payload/thread-suspend-monitor.vala index 3c1d297b1..1168c500b 100644 --- a/lib/payload/thread-suspend-monitor.vala +++ b/lib/payload/thread-suspend-monitor.vala @@ -26,9 +26,10 @@ namespace Frida { construct { var interceptor = Gum.Interceptor.obtain (); - task_threads = (TaskThreadsFunc) Gum.Module.find_export_by_name (LIBSYSTEM_KERNEL, "task_threads"); - thread_suspend = (ThreadSuspendFunc) Gum.Module.find_export_by_name (LIBSYSTEM_KERNEL, "thread_suspend"); - thread_resume = (ThreadResumeFunc) Gum.Module.find_export_by_name (LIBSYSTEM_KERNEL, "thread_resume"); + var kernel = Gum.Process.find_module_by_name (LIBSYSTEM_KERNEL); + task_threads = (TaskThreadsFunc) kernel.find_export_by_name ("task_threads"); + thread_suspend = (ThreadSuspendFunc) kernel.find_export_by_name ("thread_suspend"); + thread_resume = (ThreadResumeFunc) kernel.find_export_by_name ("thread_resume"); interceptor.replace ((void *) task_threads, (void *) replacement_task_threads, this); interceptor.replace ((void *) thread_suspend, (void *) replacement_thread_suspend, this); diff --git a/lib/payload/unwind-sitter-glue.c b/lib/payload/unwind-sitter-glue.c index 89774a0f7..19510caff 100644 --- a/lib/payload/unwind-sitter-glue.c +++ b/lib/payload/unwind-sitter-glue.c @@ -300,6 +300,7 @@ static gpointer frida_find_vtable (void) { GumAddress result = 0; + GumModule * libunwind; GumAddress export; uint64_t address; G_GNUC_UNUSED cs_err err; @@ -309,11 +310,15 @@ frida_find_vtable (void) size_t size; const size_t max_size = 2048; - export = gum_module_find_export_by_name (FRIDA_LIBUNWIND_PATH, "unw_init_local"); + libunwind = gum_process_find_module_by_name (FRIDA_LIBUNWIND_PATH); + if (libunwind == NULL) + goto beach; + + export = gum_module_find_export_by_name (libunwind, "unw_init_local"); if (export == 0) - export = gum_module_find_export_by_name (FRIDA_LIBUNWIND_PATH, "_Unwind_RaiseException"); + export = gum_module_find_export_by_name (libunwind, "_Unwind_RaiseException"); if (export == 0) - return NULL; + goto beach; export = gum_strip_code_address (export); address = export; @@ -340,7 +345,7 @@ frida_find_vtable (void) GumMemoryRange bss_range; bss_range.base_address = 0; - gum_module_enumerate_sections (FRIDA_LIBUNWIND_PATH, (GumFoundSectionFunc) frida_find_bss_range, &bss_range); + gum_module_enumerate_sections (libunwind, (GumFoundSectionFunc) frida_find_bss_range, &bss_range); while (cs_disasm_iter (capstone, &code, &size, &address, insn)) { @@ -404,6 +409,9 @@ frida_find_vtable (void) cs_free (insn, 1); cs_close (&capstone); +beach: + g_clear_object (&libunwind); + return GSIZE_TO_POINTER (result); } diff --git a/lib/payload/unwind-sitter.vala b/lib/payload/unwind-sitter.vala index 53b7824da..7591c34dd 100644 --- a/lib/payload/unwind-sitter.vala +++ b/lib/payload/unwind-sitter.vala @@ -21,7 +21,7 @@ namespace Frida { var interceptor = Gum.Interceptor.obtain (); dyld_find_unwind_sections = (DyldFindUnwindSectionsFunc) - Gum.Module.find_export_by_name (LIBDYLD, "_dyld_find_unwind_sections"); + Gum.Process.find_module_by_name (LIBDYLD).find_export_by_name ("_dyld_find_unwind_sections"); interceptor.replace ((void *) dyld_find_unwind_sections, (void *) replacement_dyld_find_unwind_sections, this); diff --git a/src/darwin/frida-helper-backend-glue.m b/src/darwin/frida-helper-backend-glue.m index fc0050225..8ef1d7708 100644 --- a/src/darwin/frida-helper-backend-glue.m +++ b/src/darwin/frida-helper-backend-glue.m @@ -396,7 +396,7 @@ static void frida_spawn_instance_unset_helpers (FridaSpawnInstance * self); static void frida_spawn_instance_call_set_helpers (FridaSpawnInstance * self, GumDarwinUnifiedThreadState * state, mach_vm_address_t helpers); static void frida_spawn_instance_call_dlopen (FridaSpawnInstance * self, GumDarwinUnifiedThreadState * state, mach_vm_address_t lib_name, int mode); -static gboolean frida_find_cf_initialize (const GumModuleDetails * details, gpointer user_data); +static gboolean frida_find_cf_initialize (GumModule * module, gpointer user_data); static void frida_spawn_instance_call_cf_initialize (FridaSpawnInstance * self, GumDarwinUnifiedThreadState * state); static void frida_spawn_instance_set_nth_breakpoint (FridaSpawnInstance * self, guint n, GumAddress break_at, FridaBreakpointRepeat repeat); static void frida_spawn_instance_enable_nth_breakpoint (FridaSpawnInstance * self, guint n); @@ -3824,15 +3824,15 @@ static void frida_darwin_helper_backend_launch_using_lsaw (NSString * identifier } static gboolean -frida_find_cf_initialize (const GumModuleDetails * details, gpointer user_data) +frida_find_cf_initialize (GumModule * module, gpointer user_data) { FridaSpawnInstance * self = user_data; GumDarwinModule * core_foundation; - if (strcmp (details->path, CORE_FOUNDATION) != 0) + if (strcmp (gum_module_get_path (module), CORE_FOUNDATION) != 0) return TRUE; - core_foundation = gum_darwin_module_new_from_memory (CORE_FOUNDATION, self->task, details->range->base_address, + core_foundation = gum_darwin_module_new_from_memory (CORE_FOUNDATION, self->task, gum_module_get_range (module)->base_address, GUM_DARWIN_MODULE_FLAGS_NONE, NULL); self->cf_initialize_address = gum_darwin_module_resolve_symbol_address (core_foundation, "___CFInitialize"); @@ -4291,7 +4291,7 @@ static void frida_darwin_helper_backend_launch_using_lsaw (NSString * identifier { GumDarwinModule * module; - module = gum_darwin_module_resolver_find_module (resolver, "/usr/lib/system/libsystem_kernel.dylib"); + module = gum_darwin_module_resolver_find_module_by_name (resolver, "/usr/lib/system/libsystem_kernel.dylib"); if (module == NULL) goto no_libc; FRIDA_AGENT_CONTEXT_RESOLVE (mach_task_self); @@ -4301,7 +4301,7 @@ static void frida_darwin_helper_backend_launch_using_lsaw (NSString * identifier FRIDA_AGENT_CONTEXT_RESOLVE (mach_port_destroy); FRIDA_AGENT_CONTEXT_RESOLVE (thread_terminate); - module = gum_darwin_module_resolver_find_module (resolver, "/usr/lib/system/libsystem_pthread.dylib"); + module = gum_darwin_module_resolver_find_module_by_name (resolver, "/usr/lib/system/libsystem_pthread.dylib"); if (module == NULL) goto no_libc; FRIDA_AGENT_CONTEXT_TRY_RESOLVE (pthread_create_from_mach_thread); @@ -4315,7 +4315,7 @@ static void frida_darwin_helper_backend_launch_using_lsaw (NSString * identifier if (mapper == NULL) { - module = gum_darwin_module_resolver_find_module (resolver, "/usr/lib/system/libdyld.dylib"); + module = gum_darwin_module_resolver_find_module_by_name (resolver, "/usr/lib/system/libdyld.dylib"); if (module == NULL) goto no_libc; FRIDA_AGENT_CONTEXT_RESOLVE (dlopen); diff --git a/src/linux/frida-helper-backend.vala b/src/linux/frida-helper-backend.vala index cb50d61f5..c51531ee4 100644 --- a/src/linux/frida-helper-backend.vala +++ b/src/linux/frida-helper-backend.vala @@ -854,12 +854,12 @@ namespace Frida { private static ProcMapsEntry? local_android_ld; static construct { - string libc_name = Gum.Process.query_libc_name (); + var libc = Gum.Process.get_libc_module (); uint local_pid = Posix.getpid (); - local_libc = ProcMapsEntry.find_by_path (local_pid, libc_name); + local_libc = ProcMapsEntry.find_by_path (local_pid, libc.path); assert (local_libc != null); - mmap_offset = (uint64) (uintptr) Gum.Module.find_export_by_name (libc_name, "mmap") - local_libc.base_address; - munmap_offset = (uint64) (uintptr) Gum.Module.find_export_by_name (libc_name, "munmap") - local_libc.base_address; + mmap_offset = (uint64) (uintptr) libc.find_export_by_name ("mmap") - local_libc.base_address; + munmap_offset = (uint64) (uintptr) libc.find_export_by_name ("munmap") - local_libc.base_address; try { var program = new Gum.ElfModule.from_file ("/proc/self/exe"); @@ -3331,11 +3331,14 @@ namespace Frida { public static ProcMapsEntry? find_by_path (uint pid, string path) { var iter = MapsIter.for_pid (pid); +#if ANDROID + unowned string libc_path = Gum.Process.get_libc_module ().path; +#endif while (iter.next ()) { string candidate_path = iter.path; if (candidate_path == path) { #if ANDROID - if (candidate_path == Gum.Process.query_libc_name () && iter.flags[3] == 's') + if (candidate_path == libc_path && iter.flags[3] == 's') continue; #endif return new ProcMapsEntry (iter.start_address, candidate_path, iter.identity); diff --git a/src/linux/system-linux.c b/src/linux/system-linux.c index 6e55c4b2f..7366d6986 100644 --- a/src/linux/system-linux.c +++ b/src/linux/system-linux.c @@ -207,7 +207,7 @@ frida_is_directory_noexec (const gchar * directory) static gchar * frida_get_application_directory (void) { - return g_path_get_dirname (gum_process_get_main_module ()->path); + return g_path_get_dirname (gum_module_get_path (gum_process_get_main_module ())); } static gboolean diff --git a/tests/test-host-session.vala b/tests/test-host-session.vala index ad1087131..b3aa6dad9 100644 --- a/tests/test-host-session.vala +++ b/tests/test-host-session.vala @@ -113,7 +113,7 @@ namespace Frida.HostSessionTest { "execvp", "execve", }; - if (Gum.Module.find_export_by_name (null, "execvpe") != 0) { + if (Gum.Module.find_global_export_by_name ("execvpe") != 0) { exec_symbol_names += "execvpe"; } foreach (var fork_symbol_name in fork_symbol_names) {