frida-gum
frida-gum copied to clipboard
Unable to locate the libc in android
Environment:
- Frida-Gum: 17.1.3
- Target Platform: Android 15
- Architecture: arm64-v8a
Issue:
The following function doesn't seem to find libc when used as a Zygisk module with statically linked Frida-Gum:
https://github.com/frida/frida-gum/blob/d83ae3ea30f7de5dad23d763a0724b5e9d451e47/gum/backend-linux/gumprocess-linux.c#L1188
This might be related to how ZygiskNext works, but I'm not completely sure.
I worked around it by calling dladdr() on the exit function instead, like this:
@@ -1185,7 +1185,7 @@ gum_try_init_libc_info (void)
if (!gum_try_resolve_dynamic_symbol ("__libc_start_main", &gum_libc_info))
#endif
{
- if (!gum_try_resolve_dynamic_symbol ("exit", &gum_libc_info))
+ if (dladdr (&exit, &gum_libc_info) == 0)
return NULL;
}
That seems to fill gum_libc_info correctly.
Not sure if this is the best or cleanest way to handle it, though.