Skip to content

[asan] Add address sanitizer support.#9857

Merged
liat-grozovik merged 3 commits intosonic-net:masterfrom
oleksandrivantsiv:asan
Feb 9, 2022
Merged

[asan] Add address sanitizer support.#9857
liat-grozovik merged 3 commits intosonic-net:masterfrom
oleksandrivantsiv:asan

Conversation

@oleksandrivantsiv
Copy link
Collaborator

Implement infrastructure that allows enabling address sanitizer
for docker containers. Enable address sanitizer for SWSS container.

Why I did it

To add a possibility to compile SONiC applications with address sanitizer (ASAN).
ASAN is a memory error detector for C/C++. It finds:

  • Use after free (dangling pointer dereference)
  • Heap buffer overflow
  • Stack buffer overflow
  • Global buffer overflow
  • Use after return
  • Use after the scope
  • Initialization order bugs
  • Memory leaks

How I did it

By adding new ENABLE_ASAN configuration option.

How to verify it

By default ASAN is disabled and the SONiC image is not affected.
When ASAN is enabled it inspects all allocation, deallocation, and memory usage that the application does in run time. To verify whether the application has memory errors tests that trigger memory usage of the application should be run. Ideally, the whole regression tests should be run. Memory leaks reports will be placed in /var/log/asan/ directory of SONiC host OS.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

dgsudharsan
dgsudharsan previously approved these changes Jan 26, 2022
@liat-grozovik liat-grozovik requested review from prsunny and removed request for lguohan, qiluo-msft and xumia January 27, 2022 11:38
@liat-grozovik
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

prsunny
prsunny previously approved these changes Jan 27, 2022
Copy link
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, request Qi/Ying to review as well

@prsunny prsunny requested review from qiluo-msft and yxieca January 27, 2022 19:36
Implement infrastructure that allows enabling address sanitizer
for docker containers. Enable address sanitizer for SWSS container.

Signed-off-by: Oleksandr Ivantsiv <oivantsiv@nvidia.com>
@liat-grozovik
Copy link
Collaborator

@oleksandrivantsiv please resolve conflicts so we can merge following the approval by Ying

@liat-grozovik liat-grozovik merged commit 25a0ce5 into sonic-net:master Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants