Skip to content

[release/10.0] Fix a series of possible race conditions in thread static variable initialization#130499

Open
nstojiljkovic wants to merge 1 commit into
dotnet:release/10.0from
nstojiljkovic:backport/127843-release-10.0
Open

[release/10.0] Fix a series of possible race conditions in thread static variable initialization#130499
nstojiljkovic wants to merge 1 commit into
dotnet:release/10.0from
nstojiljkovic:backport/127843-release-10.0

Conversation

@nstojiljkovic

Copy link
Copy Markdown

Backport of #127843 to release/10.0. Fixes the crashes tracked in #127776 and #130496.

/cc @davidwrighton

Customer Impact

  • Customer reported

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 of dotnet build, dotnet publish and 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

  • Yes
  • No

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 main since 2026-05-13 (.NET 11 previews) without follow-up issues.

…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)
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

@nstojiljkovic

Copy link
Copy Markdown
Author

@dotnet-policy-service agree company="Essential Dots"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants