Google 的 AddressSanitizer
检测 Android native 代码中的内存错误。 It does require , 然而,目标二进制文件(即可执行文件或库)使用它需要的任何标志和设置重新编译:
AddressSanitizer (ASan) is a fast compiler-based tool for detecting memory bugs in native code.
是否有一种工具可以检测 Android 内存错误而不需要对目标二进制文件进行任何重新编译?以下是关于此类工具的一些想法:
- 该工具应该拦截/ Hook
libc.so
中的相关内存相关函数(例如,malloc、free、calloc、realloc),类似于Frida拦截任何 native 代码功能的能力。 - 该工具应该通过注入(inject)进程空间来工作。从那时起,一切都应该“正常工作”。
- 它还应该拦截硬件故障和软件异常(例如,段错误)以检测内存错误。
- 有理由假设此工具不如基于编译器的 AddressSanitizer 强大,但这是意料之中的。
最佳答案
https://github.com/frida/frida-gum
需要高度精细的开发人员的帮助库:
堆分配跟踪和泄漏检查。
https://github.com/frida/frida-gum/tree/master/libs/gum/heap
使用最坏情况检查器回调进行分析。
https://github.com/frida/frida-gum/blob/7e4c5b547b035ae05d2f9e160652101bf741e6c3/libs/gum/prof/gumprofiler.h#L40-L42 https://github.com/frida/frida-gum/tree/master/libs/gum/prof
关于android - AddressSanitizer(或任何其他工具)是否可以在不需要编译的情况下检测 Android native 代码二进制文件中的内存错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62415496/