From bb70011b22cde478c1cff128082d5b9ad8b81781 Mon Sep 17 00:00:00 2001 From: Yakiv Huryk Date: Wed, 20 Jul 2022 16:49:46 +0000 Subject: [PATCH 1/2] [asan] suppress the static variable leaks This is to suppress ASAN false positives for static variables. For example, the ServiceMethodTable::m_slots is sometimes reported as leaked. Signed-off-by: Yakiv Huryk --- syncd/Asan.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/syncd/Asan.cpp b/syncd/Asan.cpp index d3f0c95d5..592c58042 100644 --- a/syncd/Asan.cpp +++ b/syncd/Asan.cpp @@ -3,6 +3,12 @@ #include #include +extern "C" { + const char* __lsan_default_suppressions() { + return "leak:__static_initialization_and_destruction_0\n"; + } +} + static void sigterm_handler(int signo) { SWSS_LOG_ENTER(); From 7b50e4860bb7fc70e2f0bd59b8f7c71583b3eb30 Mon Sep 17 00:00:00 2001 From: Yakiv Huryk Date: Fri, 22 Jul 2022 10:59:17 +0000 Subject: [PATCH 2/2] [asan] add missing SWSS_LOG_ENTER() Signed-off-by: Yakiv Huryk --- syncd/Asan.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/syncd/Asan.cpp b/syncd/Asan.cpp index 592c58042..3bc84ff64 100644 --- a/syncd/Asan.cpp +++ b/syncd/Asan.cpp @@ -5,6 +5,7 @@ extern "C" { const char* __lsan_default_suppressions() { + // SWSS_LOG_ENTER(); // disabled return "leak:__static_initialization_and_destruction_0\n"; } }