You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
fix: removal of all PLT hooks unconditionally
This commit fixes the issue where due to a confusion, ReZygisk was coded so that it would remove all PLT hooks, even if they were meant to be kept. This has been fixed appropriately in LSPlt side, allowing to revert back to how it was before.
This commit is contained in:
2
loader/src/external/lsplt
vendored
2
loader/src/external/lsplt
vendored
Submodule loader/src/external/lsplt updated: 86c228cff5...dc62fbe05e
@@ -31,6 +31,7 @@
|
||||
using namespace std;
|
||||
|
||||
static void hook_unloader();
|
||||
static void unhook_functions();
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -219,14 +220,8 @@ DCL_HOOK_FUNC(int, pthread_attr_setstacksize, void *target, size_t size) {
|
||||
if (gettid() != getpid())
|
||||
return res;
|
||||
|
||||
delete plt_hook_list;
|
||||
|
||||
if (should_unmap_zygisk) {
|
||||
if (!lsplt::InvalidateBackup()) {
|
||||
LOGE("Failed to invalidate backup for plt_hook");
|
||||
|
||||
should_unmap_zygisk = false;
|
||||
}
|
||||
unhook_functions();
|
||||
cached_map_infos.clear();
|
||||
|
||||
if (should_unmap_zygisk) {
|
||||
@@ -237,17 +232,6 @@ DCL_HOOK_FUNC(int, pthread_attr_setstacksize, void *target, size_t size) {
|
||||
|
||||
[[clang::musttail]] return munmap(start_addr, block_size);
|
||||
}
|
||||
} else {
|
||||
for (const auto &[dev, inode, sym, old_func] : *plt_hook_list) {
|
||||
if (!lsplt::RegisterHook(dev, inode, sym, *old_func, nullptr)) {
|
||||
LOGE("Failed to register plt_hook [%s]", sym);
|
||||
}
|
||||
}
|
||||
|
||||
if (!lsplt::CommitHook(cached_map_infos)) {
|
||||
LOGE("Failed to restore plt_hook");
|
||||
should_unmap_zygisk = false;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -966,3 +950,17 @@ static void hook_unloader() {
|
||||
PLT_HOOK_REGISTER(art_dev, art_inode, pthread_attr_setstacksize);
|
||||
hook_commit();
|
||||
}
|
||||
|
||||
static void unhook_functions() {
|
||||
// Unhook plt_hook
|
||||
for (const auto &[dev, inode, sym, old_func] : *plt_hook_list) {
|
||||
if (!lsplt::RegisterHook(dev, inode, sym, *old_func, nullptr)) {
|
||||
LOGE("Failed to register plt_hook [%s]", sym);
|
||||
}
|
||||
}
|
||||
delete plt_hook_list;
|
||||
if (!hook_commit()) {
|
||||
LOGE("Failed to restore plt_hook");
|
||||
should_unmap_zygisk = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user