Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ add_library(pine SHARED ${PINE_SOURCES})
find_library(log-lib log)
find_package(cxx REQUIRED CONFIG)

# support 16KB
target_link_options(pine PRIVATE "-Wl,-z,max-page-size=16384")
target_link_options(pine PRIVATE "-Wl,-z,common-page-size=16384")

target_link_libraries(pine ${log-lib} cxx::cxx)

ENABLE_LANGUAGE(ASM)
4 changes: 4 additions & 0 deletions core/src/main/cpp/pine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ void Pine_getArgsX86(JNIEnv* env, jclass, jint javaExtras, jintArray javaArray,
#endif

void Pine_syncMethodInfo(JNIEnv* env, jclass, jobject javaOrigin, jobject javaBackup, jboolean skipDeclaringClass) {
if (javaOrigin == nullptr || javaBackup == nullptr) {
LOGW("syncMethodInfo: javaOrigin or javaBackup is null");
return;
}
auto origin = art::ArtMethod::FromReflectedMethod(env, javaOrigin);
auto backup = art::ArtMethod::FromReflectedMethod(env, javaBackup);

Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/top/canyie/pine/Pine.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,15 @@ static Object callBackupMethod(HookRecord hookRecord, Object thisObject, Object[
// native entry of JNI method may be changed by RegisterNatives and UnregisterNatives,
// so we need to update them when invoke backup method.
Member origin = hookRecord.target;
if (origin == null) {
Log.w(TAG, "Target method is null!!!");
return null;
}
Method backup = hookRecord.backup;
if (backup == null) {
Log.w(TAG, "Backup method is null for " + hookRecord.target);
return null;
}
Class<?> declaring = origin.getDeclaringClass();
syncMethodInfo(origin, backup, hookRecord.skipUpdateDeclaringClass);
// FIXME: GC happens here (you can add Runtime.getRuntime().gc() to test) will crash backup calling
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.