jmpews / Dobby

a lightweight, multi-platform, multi-architecture hook framework.
Apache License 2.0
3.98k stars 822 forks source link

crashes (armv7) #23

Closed Xset-s closed 6 years ago

Xset-s commented 6 years ago

Code: default

Error: default

jmpews commented 6 years ago

try the latest commit, or like this ZzHook((void *)send, (void *)fake_send, (void **)&orig_send, common_pre_call, common_post_call, true);, use the true as the last arg. (ps: have a look with the demo project)

Xset-s commented 6 years ago

default

default

It crashes when lib loads default

Xset-s commented 6 years ago

Hm. No, it crashes after post-call 🤔

default

jmpews commented 6 years ago

emmm, i just test ok :(

android sdk version ?

Xset-s commented 6 years ago

android-19

jmpews commented 6 years ago

emmm, sorry, it's 4.am now, i need sleep, and test again on morning. use the HookZz/demo/.zip ?

Xset-s commented 6 years ago

Ok :) No, i use my own library and another apk. But it used to work

jmpews commented 6 years ago

i test armv7 again, none crash case. 🤔

Xset-s commented 6 years ago

My build log:

C:\Users\Xset\Desktop\ElfHook\HookZz>ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_ABI=armeabi-v7a APP_PLATFORM=android-19
Android NDK: WARNING:Android.mk:hookzz: LOCAL_LDLIBS is always ignored for static libraries

[armeabi-v7a] Compile thumb  : hookzz <= allocator.c
[armeabi-v7a] Compile thumb  : hookzz <= interceptor.c
[armeabi-v7a] Compile thumb  : hookzz <= memory.c
[armeabi-v7a] Compile thumb  : hookzz <= stack.c
[armeabi-v7a] Compile thumb  : hookzz <= tools.c
[armeabi-v7a] Compile thumb  : hookzz <= trampoline.c
[armeabi-v7a] Compile thumb  : hookzz <= interceptor-linux.c
[armeabi-v7a] Compile thumb  : hookzz <= memory-linux.c
[armeabi-v7a] Compile thumb  : hookzz <= thread-posix.c
[armeabi-v7a] Compile thumb  : hookzz <= instructions.c
[armeabi-v7a] Compile thumb  : hookzz <= reader-arm.c
[armeabi-v7a] Compile thumb  : hookzz <= reader-thumb.c
[armeabi-v7a] Compile thumb  : hookzz <= regs-arm.c
[armeabi-v7a] Compile thumb  : hookzz <= relocator-arm.c
././src/platforms/arch-arm/relocator-arm.c:48:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.
[armeabi-v7a] Compile thumb  : hookzz <= relocator-thumb.c
././src/platforms/arch-arm/relocator-thumb.c:120:16: warning: incompatible integer to pointer conversion initializing
      'zz_addr_t *' (aka 'unsigned long *') with an expression of type 'zz_addr_t' (aka 'unsigned long'); take the
      address with & [-Wint-conversion]
    zz_addr_t *temp_address = insn_ctx->address;
               ^              ~~~~~~~~~~~~~~~~~
                              &
1 warning generated.
[armeabi-v7a] Compile thumb  : hookzz <= writer-arm.c
[armeabi-v7a] Compile thumb  : hookzz <= writer-thumb.c
[armeabi-v7a] Compile thumb  : hookzz <= backend-arm-helper.c
[armeabi-v7a] Compile thumb  : hookzz <= interceptor-arm.c
././src/platforms/backend-arm/interceptor-arm.c:19:52: warning: incompatible pointer to integer conversion passing
      'void *' to parameter of type 'zz_addr_t' (aka 'unsigned long') [-Wint-conversion]
    zz_arm_writer_init(&backend->arm_writer, NULL, NULL);
                                                   ^~~~
C:\Users\Xset\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\5.0.300080\include\stddef.h:105:16: note:
      expanded from macro 'NULL'
#  define NULL ((void*)0)
               ^~~~~~~~~~
./src\platforms/arch-arm/writer-arm.h:30:82: note: passing argument to parameter 'target_ptr' here
void zz_arm_writer_init(ZzARMAssemblerWriter *self, zz_ptr_t data_ptr, zz_addr_t target_ptr);
                                                                                 ^
././src/platforms/backend-arm/interceptor-arm.c:23:56: warning: incompatible pointer to integer conversion passing
      'void *' to parameter of type 'zz_addr_t' (aka 'unsigned long') [-Wint-conversion]
    zz_thumb_writer_init(&backend->thumb_writer, NULL, NULL);
                                                       ^~~~
C:\Users\Xset\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\5.0.300080\include\stddef.h:105:16: note:
      expanded from macro 'NULL'
#  define NULL ((void*)0)
               ^~~~~~~~~~
./src\platforms/arch-arm/writer-thumb.h:31:86: note: passing argument to parameter 'target_ptr' here
void zz_thumb_writer_init(ZzThumbAssemblerWriter *self, zz_ptr_t data_ptr, zz_addr_t target_ptr);
                                                                                     ^
././src/platforms/backend-arm/interceptor-arm.c:145:67: warning: incompatible pointer to integer conversion passing
      'char [256]' to parameter of type 'zz_addr_t' (aka 'unsigned long') [-Wint-conversion]
        zz_thumb_writer_reset(thumb_writer, temp_code_slice_data, temp_code_slice_data);
                                                                  ^~~~~~~~~~~~~~~~~~~~
./src\platforms/arch-arm/writer-thumb.h:33:87: note: passing argument to parameter 'target_ptr' here
void zz_thumb_writer_reset(ZzThumbAssemblerWriter *self, zz_ptr_t data_ptr, zz_addr_t target_ptr);
                                                                                      ^
3 warnings generated.

[armeabi-v7a] Compile thumb  : hookzz <= thunker-arm.c
[armeabi-v7a] Compile thumb  : hookzz <= common_memory_kit.c
[armeabi-v7a] Compile thumb  : hookzz <= linux_memory_kit.c
[armeabi-v7a] Compile thumb  : hookzz <= posix_memory_kit.c
[armeabi-v7a] Compile thumb  : hookzz <= posix_thread_kit.c
[armeabi-v7a] StaticLibrary  : libhookzz.a
jmpews commented 6 years ago

fixed