Fix Dobby hook fallback

Even if dladdr could not find function name for an address given by
art_symbol_resolver, we should still process inline hook.

Close #32 as completed, close #39 as merged
This commit is contained in:
JingMatrix 2024-09-22 11:44:52 +02:00
parent 452df8c186
commit e50a3f3c38
1 changed files with 1 additions and 3 deletions

View File

@ -104,8 +104,6 @@ inline int HookPLT(void *art_symbol, void *callback, void **backup, bool save =
} }
if (auto addr = GetArt()->getSymbAddress(symbol); addr) { if (auto addr = GetArt()->getSymbAddress(symbol); addr) {
Dl_info info;
if (dladdr(addr, &info) && info.dli_sname != nullptr && strcmp(info.dli_sname, symbol) == 0)
HookInline(addr, callback, backup); HookInline(addr, callback, backup);
} else if (*backup == nullptr && isDebug) { } else if (*backup == nullptr && isDebug) {
LOGW("Failed to {} Art symbol {}", save ? "hook" : "unhook", symbol); LOGW("Failed to {} Art symbol {}", save ? "hook" : "unhook", symbol);