Fix pltHook parameters
Moreover, we may need to abandon PLT hooks in the future. Currently, there aren't many symbols found in the section .dynsym that are hooked targets of LSPlant, and more of them are found in the .symtab section. In Android 16 DP1, hooked art symbols in .dynsym (thus could be hooked using the PLT hook) are: 1. _ZN3art6mirror5Class9SetStatusENS_6HandleIS1_EENS_11ClassStatusEPNS_6ThreadE 2. _ZN3art3jit12JitCodeCache12DoCollectionEPNS_6ThreadE , while symbols in .symtab (must be hooked using inline hook) are: 1. _ZN3art11ClassLinker22FixupStaticTrampolinesEPNS_6ThreadENS_6ObjPtrINS_6mirror5ClassEEE 2. _ZN3art11ClassLinker14RegisterNativeEPNS_6ThreadEPNS_9ArtMethodEPKv 3. _ZN3art11ClassLinker16UnregisterNativeEPNS_6ThreadEPNS_9ArtMethodE 4. _ZN3art11ClassLinker26VisiblyInitializedCallback22MarkVisiblyInitializedEPNS_6ThreadE Hence, PLT hooks no longer provide sufficient advantages over inline hooks. Also, we may consider using shadowhook to replace Doddy for the arm CPU archs.
This commit is contained in:
parent
e2070858c6
commit
cc26efe6d3
|
|
@ -101,8 +101,8 @@ void MagiskLoader::InitializeLSPlant(zygisk::Api *api) {
|
|||
const auto maps = MapInfo::Scan();
|
||||
const auto libArtMap = std::find_if(maps.begin(), maps.end(),
|
||||
[libArtPath](auto it) { return it.path == libArtPath; });
|
||||
const dev_t dev = libArtMap->inode;
|
||||
const ino_t inode = libArtMap->dev;
|
||||
const dev_t dev = libArtMap->dev;
|
||||
const ino_t inode = libArtMap->inode;
|
||||
|
||||
auto HookPLT = [dev, inode, &plt_hook_saved, api](void *art_symbol, void *callback,
|
||||
void **backup, bool save = true) {
|
||||
|
|
@ -112,6 +112,7 @@ void MagiskLoader::InitializeLSPlant(zygisk::Api *api) {
|
|||
api->pltHookRegister(dev, inode, symbol, callback, backup);
|
||||
if (api->pltHookCommit() && *backup != nullptr) {
|
||||
if (save) plt_hook_saved.emplace_back(symbol, backup);
|
||||
LOGD("pltHook of {} finished", symbol);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue