[core] Fix pending hook for Android S (#278)

This commit is contained in:
LoveSy 2021-03-07 15:03:12 +08:00 committed by GitHub
parent 80abe3dc64
commit cb6f14a41a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -64,6 +64,14 @@ namespace art {
MaybeDelayHook(clazz_ptr);
});
CREATE_MEM_HOOK_STUB_ENTRIES(
"_ZN3art11ClassLinker22FixupStaticTrampolinesEPNS_6ThreadENS_6ObjPtrINS_6mirror5ClassEEE",
void, FixupStaticTrampolinesWithThread,
(void * thiz, void * self, void * clazz_ptr), {
backup(thiz, self, clazz_ptr);
MaybeDelayHook(clazz_ptr);
});
CREATE_MEM_HOOK_STUB_ENTRIES(
"_ZN3art11ClassLinker20MarkClassInitializedEPNS_6ThreadENS_6HandleINS_6mirror5ClassEEE",
void*, MarkClassInitialized, (void * thiz, void * self, uint32_t * clazz_ptr), {
@ -84,7 +92,8 @@ namespace art {
"_ZN3art11ClassLinker30ShouldUseInterpreterEntrypointEPNS_9ArtMethodEPKv",
bool, ShouldUseInterpreterEntrypoint, (void * art_method,
const void *quick_code), {
if (quick_code != nullptr && UNLIKELY(lspd::isHooked(art_method) || lspd::IsMethodPending(art_method))) {
if (quick_code != nullptr &&
UNLIKELY(lspd::isHooked(art_method) || lspd::IsMethodPending(art_method))) {
return false;
}
return backup(art_method, quick_code);
@ -157,6 +166,7 @@ namespace art {
// Therefore we hook the new introduced MarkClassInitialized instead
// This only happens on non-x86 devices
lspd::HookSyms(handle, MarkClassInitialized);
lspd::HookSyms(handle, FixupStaticTrampolinesWithThread);
} else {
lspd::HookSyms(handle, FixupStaticTrampolines);
}