-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[asan] add address sanitizer support for syncd (#1020)
add --enable-asan for syncd compilation add SIGTERM handler that calls __lsan_do_leak_check() to generate a report
- Loading branch information
1 parent
4b2638c
commit e3af0df
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "swss/logger.h" | ||
|
||
#include <csignal> | ||
#include <sanitizer/lsan_interface.h> | ||
|
||
static void sigterm_handler(int signo) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
__lsan_do_leak_check(); | ||
signal(signo, SIG_DFL); | ||
raise(signo); | ||
} | ||
|
||
__attribute__((constructor)) | ||
static void asan_init() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (signal(SIGTERM, sigterm_handler) == SIG_ERR) | ||
{ | ||
SWSS_LOG_ERROR("failed to setup SIGTERM action"); | ||
exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters