Skip to content

Commit 6ab8078

Browse files
committed
fix crash when running bangbang packed app
1 parent 965fe6a commit 6ab8078

File tree

16 files changed

+18
-2155
lines changed

16 files changed

+18
-2155
lines changed

VirtualApp/lib/src/main/jni/Android.mk

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,16 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)/Foundation
1010
LOCAL_C_INCLUDES += $(LOCAL_PATH)/MSHook
1111
LOCAL_C_INCLUDES += $(LOCAL_PATH)/GodinHook
1212

13-
ifeq ($(TARGET_ARCH_ABI),x86)
14-
ARCH_FILES := \
15-
MSHook/MSHook.cpp \
16-
MSHook/x86_64.cpp \
17-
MSHook/ARM.cpp \
18-
MSHook/Debug.cpp \
19-
MSHook/Hooker.cpp \
20-
MSHook/PosixMemory.cpp \
21-
MSHook/Thumb.cpp \
22-
MSHook/util.cpp \
23-
MSHook/x86.cpp \
24-
25-
else ifeq ($(TARGET_ARCH_ABI),x86_64)
26-
ARCH_FILES := \
27-
MSHook/MSHook.cpp \
28-
MSHook/x86_64.cpp \
29-
MSHook/ARM.cpp \
30-
MSHook/Debug.cpp \
31-
MSHook/Hooker.cpp \
32-
MSHook/PosixMemory.cpp \
33-
MSHook/Thumb.cpp \
34-
MSHook/util.cpp \
35-
MSHook/x86.cpp \
36-
37-
else
38-
ARCH_FILES := \
39-
GodinHook/mem_helper.cpp \
40-
GodinHook/instruction/instruction_helper.cpp \
41-
GodinHook/instruction/arm_instruction.cpp \
42-
GodinHook/instruction/thumb_instruction.cpp \
43-
GodinHook/native_hook.cpp \
44-
GodinHook/thread_helper.cpp \
45-
MSHook/MSHook.cpp \
46-
MSHook/x86_64.cpp \
47-
MSHook/ARM.cpp \
48-
MSHook/Debug.cpp \
49-
MSHook/Hooker.cpp \
50-
MSHook/PosixMemory.cpp \
51-
MSHook/Thumb.cpp \
52-
MSHook/util.cpp \
53-
MSHook/x86.cpp \
54-
55-
endif
13+
ARCH_FILES := \
14+
MSHook/MSHook.cpp \
15+
MSHook/x86_64.cpp \
16+
MSHook/ARM.cpp \
17+
MSHook/Debug.cpp \
18+
MSHook/Hooker.cpp \
19+
MSHook/PosixMemory.cpp \
20+
MSHook/Thumb.cpp \
21+
MSHook/util.cpp \
22+
MSHook/x86.cpp
5623

5724

5825
LOCAL_SRC_FILES := Core.cpp \

VirtualApp/lib/src/main/jni/Foundation/IOUniformer.cpp

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
//
44
#include <util.h>
55
#include "IOUniformer.h"
6-
#include "native_hook.h"
6+
//#include "native_hook.h"
77

8-
static list<std::string> ReadOnlyPathMap;
8+
static std::list<std::string> ReadOnlyPathMap;
99
static std::map<std::string/*orig_path*/, std::string/*new_path*/> IORedirectMap;
1010
static std::map<std::string/*orig_path*/, std::string/*new_path*/> RootIORedirectMap;
1111
int apiLevel;
@@ -23,11 +23,7 @@ hook_template(void *handle, const char *symbol, void *new_func, void **old_func)
2323
LOGW("Error: unable to find the Symbol : %s.", symbol);
2424
return;
2525
}
26-
#if defined(__i386__) || defined(__x86_64__)
2726
inlineHookDirect((unsigned int) (addr), new_func, old_func);
28-
#else
29-
GodinHook::NativeHook::registeredHook((size_t) addr, (size_t) new_func, (size_t **) old_func);
30-
#endif
3127
}
3228

3329
static char **patchArgv(char * const *argv) {
@@ -39,7 +35,7 @@ static char **patchArgv(char * const *argv) {
3935
for(j=0; j<i; j++) {
4036
res[j] = argv[j];
4137
}
42-
if(apiLevel >= 22) {
38+
if(apiLevel >= 21) {
4339
res[j] = "--compile-pic";
4440
j++;
4541
}
@@ -117,7 +113,7 @@ void IOUniformer::readOnly(const char *_path) {
117113

118114
bool isReadOnlyPath(const char *_path) {
119115
std::string path(_path);
120-
list<std::string>::iterator it;
116+
std::list<std::string>::iterator it;
121117
for (it = ReadOnlyPathMap.begin(); it != ReadOnlyPathMap.end(); ++it) {
122118
if (startWith(path, *it)) {
123119
return true;
@@ -643,29 +639,13 @@ void hook_dlopen(int api_level) {
643639

644640
void IOUniformer::startUniformer(int api_level, int preview_api_level) {
645641
apiLevel = api_level;
642+
HOOK_SYMBOL(RTLD_DEFAULT, chroot);
646643
HOOK_SYMBOL(RTLD_DEFAULT, kill);
647-
HOOK_SYMBOL(RTLD_DEFAULT, __getcwd);
644+
HOOK_SYMBOL(RTLD_DEFAULT, chdir);
648645
HOOK_SYMBOL(RTLD_DEFAULT, truncate);
649-
HOOK_SYMBOL(RTLD_DEFAULT, __statfs64);
650646
HOOK_SYMBOL(RTLD_DEFAULT, execve);
651-
HOOK_SYMBOL(RTLD_DEFAULT, __open);
652-
if ((api_level < 25) || (api_level == 25 && preview_api_level == 0)) {
653-
HOOK_SYMBOL(RTLD_DEFAULT, utimes);
654-
HOOK_SYMBOL(RTLD_DEFAULT, mkdir);
655-
HOOK_SYMBOL(RTLD_DEFAULT, chmod);
656-
HOOK_SYMBOL(RTLD_DEFAULT, lstat);
657-
HOOK_SYMBOL(RTLD_DEFAULT, link);
658-
HOOK_SYMBOL(RTLD_DEFAULT, symlink);
659-
HOOK_SYMBOL(RTLD_DEFAULT, mknod);
660-
HOOK_SYMBOL(RTLD_DEFAULT, rmdir);
661-
HOOK_SYMBOL(RTLD_DEFAULT, chown);
662-
HOOK_SYMBOL(RTLD_DEFAULT, rename);
663-
HOOK_SYMBOL(RTLD_DEFAULT, stat);
664-
HOOK_SYMBOL(RTLD_DEFAULT, chdir);
665-
HOOK_SYMBOL(RTLD_DEFAULT, access);
666-
HOOK_SYMBOL(RTLD_DEFAULT, readlink);
667-
HOOK_SYMBOL(RTLD_DEFAULT, unlink);
668-
}
647+
648+
HOOK_SYMBOL(RTLD_DEFAULT, utimes);
669649
HOOK_SYMBOL(RTLD_DEFAULT, fstatat);
670650
HOOK_SYMBOL(RTLD_DEFAULT, fchmodat);
671651
HOOK_SYMBOL(RTLD_DEFAULT, symlinkat);
@@ -680,10 +660,4 @@ void IOUniformer::startUniformer(int api_level, int preview_api_level) {
680660
HOOK_SYMBOL(RTLD_DEFAULT, fchownat);
681661
HOOK_SYMBOL(RTLD_DEFAULT, mknodat);
682662
// hook_dlopen(api_level);
683-
684-
#if defined(__i386__) || defined(__x86_64__)
685-
// Do nothing
686-
#else
687-
GodinHook::NativeHook::hookAllRegistered();
688-
#endif
689663
}

VirtualApp/lib/src/main/jni/GodinHook/godin_type.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

VirtualApp/lib/src/main/jni/GodinHook/hookinfo.h

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)