From 53ddc3ef7f0a66f392e085c9c7ae032fd70c9abe Mon Sep 17 00:00:00 2001 From: yinshengkai Date: Wed, 15 May 2024 17:36:32 +0800 Subject: [PATCH] arch/sim: suppress libasan checks There is a false positive in asan of gcc-13, we need to mask it to ensure that other parts work properly sanitizer_common/sanitizer_common_interceptors.inc: // FIXME: under ASan the call below may write to freed memory and corrupt // its metadata. See // https://github.com/google/sanitizers/issues/321. ==572161==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0xed3d3f00 at pc 0xef46af64 bp 0xed3d3de8 sp 0xed3d39bc WRITE of size 128 at 0xed3d3f00 thread T0 #0 0xef46af63 in __interceptor_pthread_sigmask ../../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4419 #1 0x5486aa7d in up_irq_save sim/posix/sim_hostirq.c:97 Signed-off-by: yinshengkai --- arch/sim/src/sim/sim_head.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/sim/src/sim/sim_head.c b/arch/sim/src/sim/sim_head.c index e2c3af1934111..ea2b8016fd83b 100644 --- a/arch/sim/src/sim/sim_head.c +++ b/arch/sim/src/sim/sim_head.c @@ -108,6 +108,11 @@ static void allsyms_relocate(void) ****************************************************************************/ #ifdef CONFIG_SIM_ASAN +const char *__asan_default_suppressions(void) +{ + return "interceptor_via_lib:libasan.so"; +} + const char *__asan_default_options(void) { return "abort_on_error=1"