-
Notifications
You must be signed in to change notification settings - Fork 352
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
HookingTest.hookStaticMethod test fails with crash in libart.so on Android 12 beta 4, arm64 #151
Comments
Looks like the other two tests fail in the same way:
|
YAHFA/library/src/main/jni/utils.c Line 17 in fe39712
So maybe we could set the offset value for Android 12 and try again? |
Yes, thanks for the hint!
However, the Do you know why the call to ClassLink.MakeInitializedClassesVisiblyInitialized() is needed? Log file: beta_4_yahfa_hookStaticMethod_fail_crash.txt
|
Visibly initialization was added for Class initialization after Android R. Detailed discussion for the YAHFA commits can be found here. In short, when running visibly initialization, static method addresses are resolved and the previous method hooks would be overwritten. So we have to call I guess the crash for |
hook _ZN3art11ClassLinker22FixupStaticTrampolinesEPNS_6ThreadENS_6ObjPtrINS_6mirror5ClassEEE |
I see. However calling MakeInitializedClassesVisiblyInitialized before each hook doesn't fix the static method hooking, even after I fixed the pointer to ClassLinker object. Looks like if the hooked method is static and we set art::kAccNative access flag on it => then it causes libart crash.
The backup stub is called, instead of the original method. |
This is an another issue same as Android 11's. |
how about invoking backup by reflection |
This works, but it feels uncomfortable to use reflection everytime. |
I have two devices with android 12. One build id is SP1A 210812.016.C1 which works well. Another one is SP2A 220305.012 has same issue with above. |
Logfile:
YAHFA_Android12_Beta4_Crash.txt
The text was updated successfully, but these errors were encountered: