在 arm-none-eabi 工具链中支持 ASAN 标志
Support of ASAN flags in arm-none-eabi toolchain
我正在努力将内核地址清理程序 (KASan) 从 linux 移植到另一个 os(我们称之为 OS)。这个 OS 使用 arm-none-eabi
工具链编译,我将以下作为相关标志传递给编译器:
-fsanitize=kernel-address --param asan-globals=1 --param asan-stack=1 --param asan-instrumentation-with-call-threshold=0
我还实现了不同的 __asan_*
函数,包括 __asan_register_globals
和 __asan_unregister_globals
。
我的问题是编译器只插入 __asan_load*
、__asan_store*
和 __asan_handle_no_return
函数而忽略了全局变量和堆栈。
我进行了调查,发现在 Linux 编译器中插入了全局变量和堆栈的检测,但是 Linux 使用 arm-linux-gnueabi
工具链。
谁能解释为什么 --param asan-globals=1
和 --param asan-stack=1
不影响使用 arm-none-eabi
工具链生成的代码?
或者只是为进一步搜索设定方向。
谢谢。
您不需要任何特殊函数调用来调用堆栈检测 - 影子内存通过函数序言中的内联存储中毒(并且在尾声中未中毒)。
您使用哪个 GCC 版本?全局变量的检测仅在 GCC 5.0 中完成(在 this patch) and wasn't backported to 4.9 branch. Another option option is that you forgot to use -fno-common
which is necessary to instrument common symbols.
我正在努力将内核地址清理程序 (KASan) 从 linux 移植到另一个 os(我们称之为 OS)。这个 OS 使用 arm-none-eabi
工具链编译,我将以下作为相关标志传递给编译器:
-fsanitize=kernel-address --param asan-globals=1 --param asan-stack=1 --param asan-instrumentation-with-call-threshold=0
我还实现了不同的 __asan_*
函数,包括 __asan_register_globals
和 __asan_unregister_globals
。
我的问题是编译器只插入 __asan_load*
、__asan_store*
和 __asan_handle_no_return
函数而忽略了全局变量和堆栈。
我进行了调查,发现在 Linux 编译器中插入了全局变量和堆栈的检测,但是 Linux 使用 arm-linux-gnueabi
工具链。
谁能解释为什么 --param asan-globals=1
和 --param asan-stack=1
不影响使用 arm-none-eabi
工具链生成的代码?
或者只是为进一步搜索设定方向。
谢谢。
您不需要任何特殊函数调用来调用堆栈检测 - 影子内存通过函数序言中的内联存储中毒(并且在尾声中未中毒)。
您使用哪个 GCC 版本?全局变量的检测仅在 GCC 5.0 中完成(在 this patch) and wasn't backported to 4.9 branch. Another option option is that you forgot to use -fno-common
which is necessary to instrument common symbols.