Skip to content

Commit

Permalink
Don't use sandhook on x86 devices
Browse files Browse the repository at this point in the history
  • Loading branch information
LoveSy authored and solohsu committed Sep 16, 2020
1 parent b1bc720 commit 782560a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions edxp-core/src/main/cpp/main/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace edxp {
static constexpr auto kLibFwName = "libandroidfw.so";
static constexpr auto kLibWhaleName = "libwhale.edxp.so";
static constexpr auto kLibSandHookName = "libsandhook.edxp.so";
static constexpr auto kLibDlName = "libdl.so";
static constexpr auto kLibSandHookNativeName = "libsandhook-native.so";

static const auto kLibBasePath = std::string(
Expand All @@ -41,6 +42,7 @@ namespace edxp {
LP_SELECT("/apex/com.android.runtime/bin/linker",
"/apex/com.android.runtime/bin/linker64"));

static const auto kLibDlPath = kLibBasePath + kLibDlName;
static const auto kLibArtLegacyPath = kLibBasePath + kLibArtName;
static const auto kLibWhalePath = kLibBasePath + kLibWhaleName;
static const auto kLibSandHookPath = kLibBasePath + kLibSandHookName;
Expand Down
6 changes: 6 additions & 0 deletions edxp-core/src/main/cpp/main/src/native_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ namespace edxp {
hook_func = reinterpret_cast<HookFunType>(hook_func_symbol);

if (api_level >= __ANDROID_API_Q__) {
#if defined(__i386__) || defined(__x86_64__)
ScopedDlHandle dl_handle(kLibDlPath.c_str());
void *handle = dl_handle.Get();
HOOK_FUNC(mydlopen, "__loader_dlopen");
#else
InstallLinkerHooks(kLinkerPath.c_str());
#endif
} else {
ScopedDlHandle art_handle(kLibArtLegacyPath.c_str());
InstallArtHooks(art_handle.Get());
Expand Down

0 comments on commit 782560a

Please sign in to comment.