Skip to content

Fixing macsecmgrd memory corruption #3611

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sivanuka
Copy link

Fixing macsecmgrd memory corruption

  • Macsec port update, results into memory corruption
  • Macsec profile replace -> enableMacsec -> disableMacsec[ deletes key in macsec_ports ] -> accessing dangling reference data

Fixes : #3610

What I did
I am allocating memory after deletion of previous profile.
Why I did it
Macsec profile replace -> enableMacsec -> disableMacsec[ deletes key in macsec_ports ] -> accessing dangling reference data -> memory corruption -> crash in macsecmgrd
How I verified it
After this fix, I am not seeing crashes in macsec docker container
Details if related
Valgrind traces are added in #3610

- Macsec port update, results into memory corruption
- Macsec profile replace -> enableMacsec -> disableMacsec[ deletes key
  in macsec_ports ] -> accessing dangling reference data
@sivanuka sivanuka requested a review from prsunny as a code owner April 16, 2025 06:24
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sivanuka
Copy link
Author

sivanuka commented Apr 18, 2025

Hi @prsunny,
SA checks are failing at step "install libnl3, sonic swss common and sairedis".
How to resolve it ?
is it due to any change in the PR ?
Thanks !!

@mssonicbld
Copy link
Collaborator

/azp run

@prsunny prsunny requested a review from judyjoseph April 19, 2025 00:12
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@judyjoseph
Copy link
Contributor

@sivanuka could you share the exact steps you tried to reproduce this issue ? were you using sonic CLI's ? or was it done via sonic_db_cli or other tools ?

@sivanuka
Copy link
Author

sivanuka commented Apr 24, 2025

Hi @judyjoseph,
While running sonic-mgmt macsec tests between( Sonic - cEOS ), we seen macsecmgrd crashing.
sonic-mgmt tests replacing a macsec profile with new profile while running the test https://github.com/sonic-net/sonic-mgmt/blob/master/tests/common/macsec/macsec_config_helper.py#L119 ( tests using sonic-db-cli )
We captured the valgrind logs on macsecmgrd process while running macsec sonic-mgmt tests, incorporated in #3610.
Thanks !

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Memory Corruption in macsecmgrd process
5 participants