Fix g_gc_lowest_address updating#131324
Open
janvorli wants to merge 1 commit into
Open
Conversation
There is a rare issue that occurs when virtual memory blocks allocated by GC end up getting addresses that trigger a code path where the `g_gc_lowest_address` .. `g_gc_highest_address` is expanded down and the `g_gc_lowest_address` is exactly 1/2 of the `g_gc_highest_address`. We end up setting the `g_gc_lowest_address` to 0 and that then breaks GC because it starts considering NULL references as being part of the GC heap. The culprit is a check that uses `>` instead of `>=`, which prevents the `g_gc_lowest_address` to be clamped to OS_PAGE_SIZE as its minimal value. Close dotnet#131216
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @anicka-net, @dotnet/gc |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an edge-case in CoreCLR GC card-table growth logic where expanding the tracked heap address range could incorrectly allow g_gc_lowest_address to become 0, which can cause GC to treat null references as in-heap.
Changes:
- Adjusts a boundary comparison from
>to>=when deciding whether to clamp the new lowest address toOS_PAGE_SIZE, preventing the “exactly half” span case from underflowing to0.
5 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.
There is a rare issue that occurs when virtual memory blocks allocated by GC end up getting addresses that trigger a code path where the
g_gc_lowest_address..g_gc_highest_addressis expanded down and theg_gc_lowest_addressis exactly 1/2 of theg_gc_highest_address. We end up setting theg_gc_lowest_addressto 0 and that then breaks GC because it starts considering NULL references as being part of the GC heap.The culprit is a check that uses
>instead of>=, which prevents theg_gc_lowest_addressto be clamped to OS_PAGE_SIZE as its minimal value.Close #131216