From e50a3f3c3846c69f906e83cde17ff4fe4e703eec Mon Sep 17 00:00:00 2001 From: JingMatrix Date: Sun, 22 Sep 2024 11:44:52 +0200 Subject: [PATCH] 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 --- core/src/main/jni/include/native_util.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/main/jni/include/native_util.h b/core/src/main/jni/include/native_util.h index 591b5599269..2e669d79aa6 100644 --- a/core/src/main/jni/include/native_util.h +++ b/core/src/main/jni/include/native_util.h @@ -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); }