shadowhook v2.0.1 #117
caikelun
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Announcement
1. Added compatibility with Android 17.
Supported Android OS versions: Android
4.1-17 QPR1 Beta 4.New Features
1. Added debugging information for hook/intercept operations.
tools/record_parser.pyscript to parse "operation records" (including the new trace data); it supports parsing one or multiple records at a time.Bug Fixes
1. Fixed an intermittent ANR bug.
2.0.0.dlclose()while another was executingshadowhook_hook_sym_name()within the same process.2. Fixed a bug where threads could not enter the shared-mode proxy function after executing
pthread_key_clean_all().pthread_exit()is called during thread termination; this invokespthread_key_clean_all(), which performs four rounds of TLS cleanup. Afterpthread_key_clean_all()returns,pthread_exit()proceeds to call functions likemunmap().pthread_key_clean_all(). If the proxy function was entered after this point, the original shared-mode logic could no longer function correctly. To minimize potential side effects, the previous approach was to skip the "proxy function" and call the "original function" directly. - Scope of impact: In addition to themunmap()call withinpthread_exit(), this also covers functions called by any TLS destructor functions executed during the final three rounds of TLS cleanup.3. Fixed a bug where the target ELF might not be found on Android 6.0.
android:extractNativeLibs=falseset, the ELF pathname returned bydl_iterate_phdr()does not include the!/lib/<ABI>/<lib_name>suffix. This caused the target ELF to be missed when usingdl_iterate_phdr(). We fixed this issue by dynamically parsing the ELF.dynamicsection in memory.4. Fixed a bug in shared mode where proxy functions could not be entered after the stack exceeded 16 frames.
2.0.0.2.0.0, the stack size constantSH_HUB_STACK_FRAME_MAXwas reduced from127to16for memory optimization; this violated an implicit API contract, preventing entry into proxy functions in certain scenarios. In the current version,SH_HUB_STACK_FRAME_MAXhas been reverted to127.5. Fixed an intermittent memory corruption bug.
2.0.0.[4, 16)bytes, the hooking process would overwrite the subsequent memory area, leading to subtle issues or crashes.Improvements
1. Improved the execution speed of
shadowhook_dlopen(). - We have implemented caching for frequently accessed system libraries such aslibart.so. Subsequent calls toshadowhook_dlopen()for these libraries now retrieve information from the cache, eliminating the need to acquire the linker's global mutex lock.shadowhook_hook_sym_name()also execute faster.2. Improved concurrency for hook/intercept APIs.
3. Optimized specific atomic operations and memory ordering.
公告
1. 兼容 Android 17。
支持的 Android OS 版本:Android
4.1-17 QPR1 Beta 4。新特性
1. 新增了 hook / intercept 操作的调试信息。
tools/record_parser.py脚本,用于解析“操作记录”(包括新增的 trace),一次可以解析一条或多条操作记录。Bugs 修复
1. 修复了偶发的 ANR bug。
2.0.0版本中引入的。dlclose(),另一个线程正在执行shadowhook_hook_sym_name(),这时可能会发生 ANR。2. 修复了线程执行
pthread_key_clean_all()之后无法进入 shared 模式代理函数的 bug。pthread_exit(),其中会调用pthread_key_clean_all(),这个函数中会执行4轮清理 TLS 的操作。pthread_key_clean_all()返回后,pthread_exit()还会继续调用munmap()等操作。pthread_key_clean_all()的第1轮就被清理掉。此时如果再进入代理函数,shared 模式的原有逻辑已经不可继续,为了最小化可能产生的副作用,之前的做法是跳过“代理函数”直接调用“原函数”。pthread_exit()中的munmap()以外,还包括 TLS 的后3轮清理中调用的所有 TLS 销毁函数(destructor function)中调用的其他函数。3. 修复了 Android 6.0 中可能无法找到目标 ELF 的 bug。
android:extractNativeLibs=false,此时dl_iterate_phdr()返回的 ELF pathname 末尾不会包含 '!/lib//<lib_name>' 部分,这会导致通过dl_iterate_phdr()找不到目标 ELF。我们通过动态解析内存中 ELF.dynamic的方式修复了这个 bug。4. 修复了 shared 模式中 stack 超过 16 层后无法进入代理函数的 bug。
2.0.0版本中引入的。2.0.0中,为了内存优化,把 stack 大小SH_HUB_STACK_FRAME_MAX从127改成了16,这破环了潜在的 API 契约,导致了在某些情况下无法进入代理函数。在现有版本中把SH_HUB_STACK_FRAME_MAX改回了127。5. 修复了偶发的内存踩踏 bug。
2.0.0版本中引入的。[4, 16)字节范围内时,hook 会覆盖其后的内存区域,导致难以察觉的问题或崩溃。改进
1. 提升了
shadowhook_dlopen()的执行速度。libart.so等高频关注的系统库信息做了缓存,再次shadowhook_dlopen()这些系统库时支持从缓存中获取信息,不会再去持有 linker 的全局 mutex 锁。shadowhook_hook_sym_name()等。2. 改进了 hook / intercept API 的并发性。
3. 优化了部分 atomic 操作以及 memory order。
This discussion was created from the release shadowhook v2.0.1.
Beta Was this translation helpful? Give feedback.
All reactions