Skip to content

Commit

Permalink
Reset JIT table when hooking a method, otherwise the old method can s…
Browse files Browse the repository at this point in the history
…till get called directly
  • Loading branch information
rovo89 committed Apr 9, 2012
1 parent 2cf2428 commit 8927eed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ LOCAL_C_INCLUDES += dalvik \
LOCAL_MODULE:= xposed
LOCAL_MODULE_TAGS := optional

LOCAL_CFLAGS += -DWITH_JIT

include $(BUILD_EXECUTABLE)
9 changes: 9 additions & 0 deletions xposed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include <stdio.h>
#include <sys/stat.h>

#ifdef WITH_JIT
#include <interp/Jit.h>
#endif

namespace android {

////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -294,6 +298,11 @@ static void de_robv_android_xposed_XposedBridge_hookMethodNative(JNIEnv* env, jc
SET_METHOD_FLAG(method, ACC_NATIVE);
method->nativeFunc = &xposedCallHandler;
method->registersSize = method->insSize;
method->outsSize = 0;
#ifdef WITH_JIT
LOGI("reset JIT\n");
dvmJitResetTable();
#endif
}

// simplified copy of Method.invokeNative, but calls the original (non-hooked) method and has no access checks
Expand Down

0 comments on commit 8927eed

Please sign in to comment.