[release/10.0] Fix a series of possible race conditions in thread static variable initialization#130499
Open
nstojiljkovic wants to merge 1 commit into
Open
Conversation
…itialization (dotnet#127843) - The two critical ones are the one just after the memcpy in the TLSIndexToMethodTableMap, as well as the VolatileStore when setting pIndex. Fixes dotnet#127776 --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> (cherry picked from commit c3be9c8)
Contributor
|
Tagging subscribers to this area: @agocke |
Author
|
@dotnet-policy-service agree company="Essential Dots" |
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 #127843 to release/10.0. Fixes the crashes tracked in #127776 and #130496.
/cc @davidwrighton
Customer Impact
Intermittent SIGSEGV in
GetThreadLocalStaticBase/ JIT'd code touching thread-statics under parallel load on weakly-ordered arm64 hosts. Hit by Microsoft's own dotnet/sdk CI on macOS arm64 (#127776) and by our production CI on linux-arm64 (#130496): intermittent crashes ofdotnet build,dotnet publishand VSTest test hosts, plus occasional silent state corruption in concurrent code consistent with the same publication race. Frequency scales with core count and concurrency — on a 20-core heterogeneous arm64 host (10x Cortex-X925 + 10x Cortex-A725, two L3 domains) it reproduces within hours of normal CI load.Regression
The race has been present in the thread-static infrastructure; modern many-core arm64 hardware makes it readily observable.
Testing
The cherry-pick applies cleanly to release/10.0 (no conflicts; ordering-only change). We are validating a runtime built from this branch on the reporting hardware (NVIDIA GB10, Ubuntu 24.04 arm64) against the parallel build/test loop that reproduces the crash on 10.0.8/10.0.9 — results will be posted here. Full minidumps and crash reports from the unfixed runtime are available in #130496.
Risk
Low. The change only strengthens memory-ordering guarantees (VolatileStore on TLS index map resize, entry updates and index allocation) with no algorithmic changes, and has been in
mainsince 2026-05-13 (.NET 11 previews) without follow-up issues.