[core] Remove reflection hook (#666)
We previously hook reflection because we want only the hooker class to have the privilege to access the backup method. However, we now found that the backup method is a private copy and cannot be accessed by outer classes, so we remove the relection hook for efficiency.
This commit is contained in:
parent
bf63d97fb6
commit
21d05486df
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* This file is part of LSPosed.
|
||||
*
|
||||
* LSPosed is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LSPosed is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) 2020 EdXposed Contributors
|
||||
* Copyright (C) 2021 LSPosed Contributors
|
||||
*/
|
||||
|
||||
#ifndef LSPOSED_REFLECTION_H
|
||||
#define LSPOSED_REFLECTION_H
|
||||
|
||||
#include "base/object.h"
|
||||
|
||||
namespace art {
|
||||
|
||||
CREATE_HOOK_STUB_ENTRIES(
|
||||
"_ZN3art12VerifyAccessENS_6ObjPtrINS_6mirror6ObjectEEENS0_INS1_5ClassEEEjS5_",
|
||||
bool, VerifyAccess,
|
||||
(void * obj, void * declaring_class, uint32_t access_flags, void * calling_class), {
|
||||
auto calling_desc = art::mirror::Class(calling_class).GetDescriptor();
|
||||
if (UNLIKELY(calling_desc.find("de/robv/android/xposed/LspHooker") !=
|
||||
std::string::npos)) {
|
||||
return true;
|
||||
}
|
||||
return backup(obj, declaring_class, access_flags, calling_class);
|
||||
});
|
||||
|
||||
static void PermissiveAccessByReflection(void *handle) {
|
||||
lspd::HookSym(handle, VerifyAccess);
|
||||
}
|
||||
}
|
||||
#endif //LSPOSED_REFLECTION_H
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
#include "art/runtime/thread.h"
|
||||
#include "art/runtime/hidden_api.h"
|
||||
#include "art/runtime/instrumentation.h"
|
||||
#include "art/runtime/reflection.h"
|
||||
#include "art/runtime/thread_list.h"
|
||||
#include "art/runtime/gc/scoped_gc_critical_section.h"
|
||||
|
||||
|
|
@ -69,7 +68,6 @@ namespace lspd {
|
|||
art::mirror::Class::Setup(art_handle);
|
||||
art::JNIEnvExt::Setup(art_handle);
|
||||
art::instrumentation::DisableUpdateHookedMethodsCode(art_handle);
|
||||
art::PermissiveAccessByReflection(art_handle);
|
||||
art::thread_list::ScopedSuspendAll::Setup(art_handle);
|
||||
art::gc::ScopedGCCriticalSection::Setup(art_handle);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class LspHooker {
|
|||
this.additionalInfo = info;
|
||||
this.method = origin;
|
||||
this.backup = backup;
|
||||
this.backup.setAccessible(true);
|
||||
}
|
||||
|
||||
public Object invokeOriginalMethod(Object thisObject, Object[] args) throws InvocationTargetException, IllegalAccessException {
|
||||
|
|
|
|||
Loading…
Reference in New Issue