Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[LP] ART inlines very simple methods #4
From @DavisNT on February 25, 2015 6:58
In current Xposed for Lollipop alpha it is not possible to hook very simple methods (e.g.
Copied from original issue: rovo89/Xposed#21
I can reproduce it,
@vladpolkovnik had contacted me with his approach (including code), which also contained some changes in the compiler. I'll wait for his update to see which of them should be included in Xposed.
Xposed modules are loaded in the Zygote process. ART compiles the .dex file and opens the resulting .oat file in the Dalvik cache for that. However, the same happens again when the user installs a new version of the module, overwriting the file in the Dalvik cache. When opening the new .oat file though, ART detects that the file is already opened and reuses this instance. Later, it detects that the checksum doesn't match, which causes a crash. This will only occur on every second update (without reboot) as Android uses alternating suffixes for the .apk files (-1.apk / -2.apk). Let's work around it by ignoring already opened .oat files if they have been opened in Zygote. The behavior for files in /system (boot image and framework) is unchanged. Fixes rovo89/Xposed#22.
Crash logs: Build fingerprint: 'samsung/jaltektt/jaltektt:5.0.1/LRX22C/E300KKTUGOL5:user/release-keys' Revision: '10' ABI: 'arm' pid: 14496, tid: 14496, name: com.kakao.talk >>> com.kakao.talk <<< signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x3c r0 beb99350 r1 beb990c0 r2 00000001 r3 00000000 ... backtrace: #00 pc 00164c5a /system/lib/libart.so (bool art::interpreter::DoFieldPut<(art::FindFieldType)1, (art::Primitive::Type)0, true, false>(art::Thread*, art::ShadowFrame const&, art::Instruction const*, unsigned short)+585) rovo89#1 pc 000a045b /system/lib/libart.so (art::JValue art::interpreter::ExecuteGotoImpl<true, false>(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue)+24290) rovo89#2 pc 0015fe2d /system/lib/libart.so (art::interpreter::EnterInterpreterFromStub(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&)+180) rovo89#3 pc 002860e7 /system/lib/libart.so (artQuickToInterpreterBridge+482) rovo89#4 pc 000a8d9b /system/lib/libart.so (art_quick_to_interpreter_bridge+10) rovo89#5 pc 004ea7dc /dev/ashmem/dalvik-main space (deleted) ... E/NativeCrashHandler(16201): Crash In Native Code! [pid: 16201 | tid 16201] F/art (16201): art/runtime/thread.cc:1108] No pending exception expected: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/animation/BaseInterpolator; ... F/art (16201): art/runtime/thread.cc:1108] Caused by: java.lang.ClassNotFoundException: Didn't find class android.view.animation.BaseInterpolator on path: DexPathList[[zip file /system/framework/com.google.android.maps.jar, zip file /data/app/com.kakao.talk-1/base.apk],nativeLibraryDirectories=[/data/app/com.kakao.talk-1/lib/arm, /vendor/lib, /system/lib]] F/art (16201): art/runtime/thread.cc:1108] at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56) ... Relatited commmit : 0e430fa