-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[asan] add address sanitizer support for syncd #1020
Conversation
* add --enable-asan for syncd compilation * add SIGTERM handler that calls __lsan_do_leak_check() to generate a report Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
syncd/main.cpp
Outdated
int syncd_main(int argc, char **argv); | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
#if defined(ASAN_ENABLED) | ||
if (signal(SIGTERM, sigterm_handler) == SIG_ERR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need to install signal handler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Mellanox platform, we don't stop the syncd via syncd_request_shutdown (https://github.com/Azure/sonic-buildimage/blob/master/files/scripts/syncd.sh#L55).
So, in order for us to generate the asan report, we need to catch the SIGTERM and generate it explicitly via __lsan_do_leak_check().
Another benefit of this approach is that in such case, the report will not contain any records of memory with the program's lifetime.
would it be possible to make this as separate file and signal handler marka as attribute((constructor)) ? And include this file for compilation only when asan is enabled? |
Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
7a0ad21
Good idea, thanks. |
add --enable-asan for syncd compilation add SIGTERM handler that calls __lsan_do_leak_check() to generate a report
report
Signed-off-by: Yakiv Huryk yhuryk@nvidia.com