[release/11.0] Fix GC on Windows with multiple CPU groups - #134216
Open
github-actions[bot] wants to merge 1 commit into
Open
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
When there are multiple CPU groups on Windows, the OS can assign the current process into any of these groups. When CPU groups support is not enabled for GC (using DOTNET_GCCpuGroup=1 or other means), the CPU index that is computed from the group index and cpu number exceeds some of the preallocated arrays for mapping processor to heap or numa node to heap and it can result in writing past those arrays, corrupting other heap allocations. This change fixes it by getting the max processor count based on the max CPU group count. This max count includes even possibly hot-plugged CPU groups.
|
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 |
jkotas
approved these changes
Sep 18, 2026
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.
Backport of #134127 to release/11.0.
Customer Impact
On Windows systems with multiple CPU groups, a process running in a nonzero processor group can use a packed processor index beyond the dynamically allocated GC processor-to-heap mapping. This can write past the allocation and cause heap corruption when GC CPU-group support is disabled.
The fix sizes the relevant mappings and affinity set for the maximum possible processor-group index space. It also validates and caches the Windows processor-group count during GC OS initialization.
This issue was reported by two 1st party customers independently.
Regression
Regression introduced by #131740.
Testing
CoreCLR tests
Risk
Low. This is a direct backport of the fix merged into main in #134127. The change only increases Windows GC processor-indexed allocation capacity and fails initialization if the topology API unexpectedly returns zero.
Note
This pull request description was generated with GitHub Copilot.