-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
zebra: Ensure non-equal id's are not same nhg's #16554
Merged
ton31337
merged 1 commit into
FRRouting:master
from
donaldsharp:zebra_ensure_no_use_after_free
Aug 12, 2024
Merged
zebra: Ensure non-equal id's are not same nhg's #16554
ton31337
merged 1 commit into
FRRouting:master
from
donaldsharp:zebra_ensure_no_use_after_free
Aug 12, 2024
Conversation
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
The function zebra_nhg_hash_equal is only used as a hash function for storage of NHG's and retrieval. If you have say two nhg's: 31 (25/26) 32 (25/26) This function would return them as being equal. Which of course leads to the problem when you attempt to hash_release 32 but release 31 from the hash. Then later when you attempt to do hash comparisons 32 has actually been freed leaving to use after free situations and shit goes down hill fast. This hash is only used as part of the hash comparison function for nexthop group storage. Since this is so let's always return the 31/32 nhg's are not equal at all. We possibly have a different problem where we are creating 31 and 32 ( when 31 should have just been used instead of 32 ) but we need to prevent any type of hash release problem at all. This supercedes any other issue( that should be tracked down on it's own ). Since you can have use after free situation that leads to a crash -vs- some possible nexthop group duplication which is very minor in comparison. Signed-off-by: Donald Sharp <[email protected]>
this will fix an occasional crash that we are seeing in ospf_basic_functionality I believe |
ton31337
approved these changes
Aug 11, 2024
Valid failure?
|
I've been seeing that one off/on for the last couple of weeks. So no I do not believe it is |
@Mergifyio backport stable/10.1 stable/10.0 stable/9.1 stable/9.0 |
✅ Backports have been created
|
This was referenced Aug 12, 2024
donaldsharp
added a commit
that referenced
this pull request
Aug 13, 2024
zebra: Ensure non-equal id's are not same nhg's (backport #16554)
donaldsharp
added a commit
that referenced
this pull request
Aug 13, 2024
zebra: Ensure non-equal id's are not same nhg's (backport #16554)
donaldsharp
added a commit
that referenced
this pull request
Aug 13, 2024
zebra: Ensure non-equal id's are not same nhg's (backport #16554)
donaldsharp
added a commit
that referenced
this pull request
Aug 13, 2024
zebra: Ensure non-equal id's are not same nhg's (backport #16554)
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.
The function zebra_nhg_hash_equal is only used
as a hash function for storage of NHG's and retrieval. If you have say two nhg's:
31 (25/26)
32 (25/26)
This function would return them as being equal. Which of course leads to the problem when you attempt to hash_release 32 but release 31 from the hash. Then later when you attempt to do hash comparisons 32 has actually been freed leaving to use after free situations and shit goes down hill fast.
This hash is only used as part of the hash comparison function for nexthop group storage. Since this is so let's always return the 31/32 nhg's are not equal at all.
We possibly have a different problem where we are creating 31 and 32 ( when 31 should have just been used instead of 32 ) but we need to prevent any type of hash release problem at all. This supercedes any other issue( that should be tracked down on it's own ). Since you can have use after free situation that leads to a crash -vs- some possible nexthop group duplication which is very minor in comparison.