Add optional ASAN test-leak injection gated by a config file - #4813
Open
judsonwilson-nvidia wants to merge 2 commits into
Open
Add optional ASAN test-leak injection gated by a config file#4813judsonwilson-nvidia wants to merge 2 commits into
judsonwilson-nvidia wants to merge 2 commits into
Conversation
If /etc/sonic/inject_asan_test_leak_enabled exists, swss daemons inject a known leak, so that when sent SIGTERM the leak detector will emit an ASAN report. This can be used to verify that the ASAN build and the leak check in the signal handler are working as intended. This matches a similar addition being made in sonic-sairedis. How to verify it: 1. Create /etc/sonic/inject_asan_test_leak_enabled. 2. Restart the daemon once if necessary (e.g. `config reload`) so it starts with leak injection enabled. 3. Run `config reload` or reboot to send SIGTERM to the daemon. 4. After it exits, daemons that are working correctly will produce ASAN report files in /var/log/asan/. Signed-off-by: Judson Wilson <judsonw@nvidia.com>
judsonwilson-nvidia
requested review from
Pterosaur,
judyjoseph and
prsunny
as code owners
August 3, 2026 17:45
Collaborator
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Collaborator
|
Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks! ---Powered by SONiC BuildBot
|
dgsudharsan
previously approved these changes
Aug 3, 2026
Collaborator
|
Hi @sonic-net/sonic-swss-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks! ---Powered by SONiC BuildBot
|
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Judson Wilson <judsonw@nvidia.com>
judsonwilson-nvidia
force-pushed
the
asan_leak_injection
branch
from
August 6, 2026 02:44
1cbb926 to
4e83557
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
12 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
ASAN builds need a way to confirm that LSan and the SIGTERM leak check are
actually firing. Without a controlled leak, a silent miss looks the same as a
clean exit. A matching change is in sonic-sairedis (
syncd/Asan.cpp).sonic-net/sonic-sairedis#2025
This can be used to help detect issues like the following where ASAN is not
configured correctly:
sonic-net/sonic-buildimage#28279
Work item tracking
How I did it
lib/asan.cpp, when/etc/sonic/inject_asan_test_leak_enabledexists atstartup, inject a fixed-size intentional leak so the SIGTERM LSan check has
something to report.
unreachable after join (avoids ASAN fake-stack false reachability at -O2).
syncd/Asan.cpp.How to verify it
/etc/sonic/inject_asan_test_leak_enabled.config reload) so it starts withleak injection enabled.
config reloador reboot to send SIGTERM./var/log/asan/.Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Add optional ASAN test-leak injection gated by a config file for testing ASAN functionality.
A picture of a cute animal (not mandatory but encouraged)