First, thank you for all the great things you achieve here!
Starting from Android 8.1, new annotations have been introduced to speed up native JNI calls in Android middleware, one of these annotations is "CriticalNative" (e.g., see googlesource).
According to the documentation (documentation), "The @CriticalNative annotation provides {..} faster way to run native methods, with {..} restrictions."
Now, whenever I try to instrument a java native method that is annotated by @CriticalNative, ART crashes with the following error:
F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
F DEBUG : Build fingerprint: 'generic/aosp_cf_x86_phone/vsoc_x86:10/QQ1D.200205.002/eng.abdall.20200224.133142:userdebug/test-keys'
F DEBUG : Revision: '0'
F DEBUG : ABI: 'x86'
F DEBUG : Timestamp: 2020-03-05 12:21:23-0330
F DEBUG : pid: 13035, tid: 13051, name: Binder:13035_2 >>> system_server <<<
F DEBUG : uid: 1000
F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x88b1474
F DEBUG : eax 088b1474 ebx e97b9a74 ecx 8bd589cb edx da618684
F DEBUG : edi 00000004 esi 00000000
F DEBUG : ebp be3fae88 esp be3fae40 eip e93f7a36
F DEBUG :
F DEBUG : backtrace:
F DEBUG : #00 pc 002e3a36 /apex/com.android.runtime/lib/libart.so!libart.so (offset 0x1c3000) (art::IndirectReferenceTable::Dump(std::__1::basic_ostream<char, std::__1::char_traits>&) const+134) (BuildId: 354ca8e1c28a50e77c63f80311270dba)
F DEBUG : frida/frida#1 pc 002e3ca4 /apex/com.android.runtime/lib/libart.so!libart.so (offset 0x1c3000) (art::IndirectReferenceTable::EnsureFreeCapacity(unsigned int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>)+404) (BuildId: 354ca8e1c28a50e77c63f80311270dba)
F DEBUG : frida/frida#2 pc 004573cc /apex/com.android.runtime/lib/libart.so!libart.so (offset 0x3f6000) (art::JNI::EnsureLocalCapacityInternal(art::ScopedObjectAccess&, int, char const)+92) (BuildId: 354ca8e1c28a50e77c63f80311270dba)
F DEBUG : frida/frida#3 pc 003f575a /apex/com.android.runtime/lib/libart.so!libart.so (offset 0x3f4000) (art::JNI::PushLocalFrame(_JNIEnv*, int)+810) (BuildId: 354ca8e1c28a50e77c63f80311270dba)
F DEBUG : frida/frida#4 pc 0010aa27 /data/local/tmp/re.frida.server/frida-agent-32.so
F DEBUG : frida/frida#5 pc 0010a724 /data/local/tmp/re.frida.server/frida-agent-32.so
The code snippet that causes this crash is:
Java.perform(function () {
var clazz = Java.use("android.os.Binder");
clazz.getCallingUid.implementation = function() {
var ret = this.getCallingUid();
console.log('getCallingUid', ret);
return ret;
}
});
Frida-server version is: 12.8.13
I run x86 Android version of API 29 and the process that I'm trying to instrument is system_server.
Does anybody know how to fix this? I believe modifications to frida-core are required but I don't know where/how to start. Any help would be appreciated.
First, thank you for all the great things you achieve here!
Starting from Android 8.1, new annotations have been introduced to speed up native JNI calls in Android middleware, one of these annotations is "CriticalNative" (e.g., see googlesource).
According to the documentation (documentation), "The @CriticalNative annotation provides {..} faster way to run native methods, with {..} restrictions."
Now, whenever I try to instrument a java native method that is annotated by @CriticalNative, ART crashes with the following error:
The code snippet that causes this crash is:
Frida-server version is: 12.8.13
I run x86 Android version of API 29 and the process that I'm trying to instrument is system_server.
Does anybody know how to fix this? I believe modifications to frida-core are required but I don't know where/how to start. Any help would be appreciated.