Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LP] ART inlines very simple methods #4

Closed
rovo89 opened this issue Feb 25, 2015 · 4 comments

Comments

@rovo89
Copy link
Owner

commented Feb 25, 2015

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. method2() from unmodified code sample https://github.com/DavisNT/XposedLollipopTests/ ).
Most likely this happens due to inlining of very simple methods (when uncommenting Log.i() inside method2() the method becomes hookable).

Copied from original issue: rovo89/Xposed#21

@rovo89

This comment has been minimized.

Copy link
Owner Author

commented Feb 25, 2015

@DavisNT I moved the issue here because I think that this is the spot where it needs to be fixed.

@rovo89

This comment has been minimized.

Copy link
Owner Author

commented Mar 1, 2015

I can reproduce it, method2() is indeed inlined. This is probably also the reason for issues like this:
http://forum.xda-developers.com/xposed/hooking-t3030626
(and the workaround to use Boolean instead of boolean probably works because the former isn't simple enough)

@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.

@rovo89 rovo89 added the bug label Mar 1, 2015
@rovo89 rovo89 self-assigned this Mar 1, 2015
@rovo89

This comment has been minimized.

Copy link
Owner Author

commented Mar 1, 2015

On a side note: @DavisNT, Eclipse automatically bundles jars in the libs folder into the APK, that's why it's getting huge. Try calling the folder lib or something for those libraries that you only want to reference (like the Xposed API).

@DavisNT

This comment has been minimized.

Copy link

commented Mar 1, 2015

Offtopic: Thanks for the side note! IMHO leaving unneeded android-support-v4.jar in Xposed modules is a really common mistake - I have even reported this to other developers (and done this in my own released Xposed modules).

@rovo89 rovo89 closed this in d586da3 Mar 8, 2015
C3C0 referenced this issue Jun 9, 2015
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.
Liliniser added a commit to Liliniser/android_art that referenced this issue Aug 31, 2016
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
@duoniduoni duoniduoni referenced this issue Apr 28, 2017
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.