Skip to content

Commit

Permalink
Fix Dobby hook fallback
Browse files Browse the repository at this point in the history
Even if dladdr could not find function name for an address given by
art_symbol_resolver, we should still process inline hook.
  • Loading branch information
JingMatrix committed Sep 22, 2024
1 parent 0a164a2 commit 82689be
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/src/main/jni/include/native_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ inline int HookPLT(void *art_symbol, void *callback, void **backup, bool save =
}

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) {
LOGW("Failed to {} Art symbol {}", save ? "hook" : "unhook", symbol);
}
Expand Down

0 comments on commit 82689be

Please sign in to comment.