1 /* 2 * Copyright (c) 2019 Jan Van Winkel <jan.van_winkel@dxplore.eu> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #if defined(CONFIG_64BIT) && defined(__GNUC__) && !defined(__clang__) __asan_default_options(void)8const char *__asan_default_options(void) 9 { 10 /* Running leak detection at exit could lead to a deadlock on 11 * 64-bit boards if GCC is used. 12 * https://github.com/zephyrproject-rtos/zephyr/issues/20122 13 */ 14 return "leak_check_at_exit=0:"; 15 } 16 #endif 17 18 #ifdef CONFIG_HAS_SDL __lsan_default_suppressions(void)19const char *__lsan_default_suppressions(void) 20 { 21 /* The SDL2 library does not clean-up all it resources on exit, 22 * as such suppress all memory leaks coming from libSDL2 and the 23 * underlying X11 library 24 */ 25 return "leak:libX11\nleak:libSDL2\n"; 26 } 27 #endif /* CONFIG_HAS_SDL */ 28 29 #ifdef CONFIG_ASAN_NOP_DLCLOSE 30 /* LSAN has a known limitation that if dlcose is called before performing the 31 * leak check; "<unknown module>" is reported in the stack traces during the 32 * leak check and these can not be suppressed, see 33 * https://github.com/google/sanitizers/issues/89 for more info. 34 * 35 * A workaround for this is to implement a NOP version of dlclose. 36 */ dlclose(void * handler)37int dlclose(void *handler) 38 { 39 return 0; 40 } 41 #endif /* CONFIG_ASAN_NOP_DLCLOSE */ 42