Fix "ELOOP: too many symbolic links encountered"
This commit is contained in:
parent
68cf907041
commit
4b55e3d033
|
|
@ -80,12 +80,16 @@ static void hook_IsInSamePackage(int api_level, void *artHandle,
|
|||
isInSamePackageSym = "_ZN3art6mirror5Class15IsInSamePackageENS_6ObjPtrIS1_EE";
|
||||
}
|
||||
void *original = dlsym(artHandle, isInSamePackageSym);
|
||||
getDesc = reinterpret_cast<const char *(*)(void *, std::string *)>(dlsym(artHandle,
|
||||
getDescriptorSym));
|
||||
if (!original) {
|
||||
LOGE("can't get isInSamePackageSym");
|
||||
LOGE("can't get isInSamePackageSym: %s", dlerror());
|
||||
return;
|
||||
}
|
||||
void *getDescSym = dlsym(artHandle, getDescriptorSym);
|
||||
if (!getDescSym) {
|
||||
LOGE("can't get GetDescriptorSym: %s", dlerror());
|
||||
return;
|
||||
}
|
||||
getDesc = reinterpret_cast<const char *(*)(void *, std::string *)>(getDescSym);
|
||||
(*hookFun)(original, reinterpret_cast<void *>(onIsInSamePackageCalled),
|
||||
reinterpret_cast<void **>(&isInSamePackageBackup));
|
||||
}
|
||||
|
|
@ -95,21 +99,21 @@ void install_inline_hooks() {
|
|||
if (api_level < ANDROID_LOLLIPOP) {
|
||||
return;
|
||||
}
|
||||
void *whaleHandle = dlopen(kLibWhalePath, RTLD_NOW);
|
||||
void *whaleHandle = dlopen(kLibWhalePath, RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (!whaleHandle) {
|
||||
LOGE("can't open libwhale");
|
||||
LOGE("can't open libwhale: %s", dlerror());
|
||||
return;
|
||||
}
|
||||
void *hookFunSym = dlsym(whaleHandle, "WInlineHookFunction");
|
||||
if (!hookFunSym) {
|
||||
LOGE("can't get WInlineHookFunction");
|
||||
LOGE("can't get WInlineHookFunction: %s", dlerror());
|
||||
return;
|
||||
}
|
||||
void (*hookFun)(void *, void *, void **) = reinterpret_cast<void (*)(void *, void *,
|
||||
void **)>(hookFunSym);
|
||||
void *artHandle = dlopen(kLibArtPath, RTLD_NOW);
|
||||
void *artHandle = dlopen(kLibArtPath, RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (!artHandle) {
|
||||
LOGE("can't open libart");
|
||||
LOGE("can't open libart: %s", dlerror());
|
||||
return;
|
||||
}
|
||||
hook_IsInSamePackage(api_level, artHandle, hookFun);
|
||||
|
|
@ -118,5 +122,7 @@ void install_inline_hooks() {
|
|||
} else {
|
||||
LOGE("disable_HiddenAPIPolicyImpl failed.");
|
||||
}
|
||||
dlclose(whaleHandle);
|
||||
dlclose(artHandle);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue