bytedance / bhook

:fire: ByteHook is an Android PLT hook library which supports armeabi-v7a, arm64-v8a, x86 and x86_64.
https://github.com/bytedance/bhook/tree/main/doc#readme
MIT License
2.05k stars 315 forks source link

called in a non-hook status? #39

Closed fh2002 closed 2 years ago

fh2002 commented 2 years ago

bytehook Version

1.0.5

Android OS Version

7.1

Android ABIs

armeabi-v7a

Device Manufacturers and Models

any

Describe the Bug

bhook拦截了dlsym函数 FILE new_fopen(const char path, const char* mode){ BYTEHOOK_STACK_SCOPE(); return BYTEHOOK_CALL_PREV(new_fopen, path, mode);; } void new_dlsym(void handle, const char* symbol){ BYTEHOOK_STACK_SCOPE(); void rs = NULL; if(strcmp(__symbol, "fopen") == 0) rs = (void)new_fopen; else rs = BYTEHOOK_CALL_PREV(new_dlsym, handle, symbol); LOGD("dlsym: %s, func:%p", __symbol, rs); return rs; }

如果目标应用通过dlsym来调用fopen的时候会崩溃,我看源码中写有 if (0 == stack->frames_cnt) abort(); // called in a non-hook status? 有啥办法解决吗?