mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
sim/lsan: disable fast-unwind by default
The fast-unwind implementation of leak-sanitizer will obtain the current stack top/bottom and frame address(Stack Pointer) for backtrace calculation: https://github.com/gcc-mirror/gcc/blob/releases/gcc-13/libsanitizer/lsan/lsan.cpp#L39-L42 Since the scheduling mechanism of NuttX sim is coroutine (setjmp/longjmp), if the Stack Pointer is switched, the fast-unwind will unable to get the available address, so the memory leaks on the system/application side that cannot be caught normally. This PR will disable fast-unwind by default to avoid unwind failure. Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
1e22163b57
commit
1be95c3313
@@ -97,6 +97,36 @@ static void allsyms_relocate(void)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: __lsan_default_options
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function may be optionally provided by user and should return
|
||||||
|
* a string containing leak sanitizer runtime options.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SIM_ASAN
|
||||||
|
const char *__lsan_default_options(void)
|
||||||
|
{
|
||||||
|
/* The fast-unwind implementation of leak-sanitizer will obtain the
|
||||||
|
* current stack top/bottom and frame address(Stack Pointer) for
|
||||||
|
* backtrace calculation:
|
||||||
|
*
|
||||||
|
* https://github.com/gcc-mirror/gcc/blob/releases/gcc-13/libsanitizer/
|
||||||
|
* lsan/lsan.cpp#L39-L42
|
||||||
|
*
|
||||||
|
* Since the scheduling mechanism of NuttX sim is coroutine
|
||||||
|
* (setjmp/longjmp), if the Stack Pointer is switched, the fast-unwind
|
||||||
|
* will unable to get the available address, so the memory leaks on the
|
||||||
|
* system/application side that cannot be caught normally. This PR will
|
||||||
|
* disable fast-unwind by default to avoid unwind failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
return "fast_unwind_on_malloc=0";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: main
|
* Name: main
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user