Draft
[release/10.0] Backport #127638: Fix !m_RedirectContextInUse assert in RestoreContextSimulated on win-x86#130986
Conversation
|
Azure Pipelines: 15 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
Author
Azure Pipelines: ...
|
Copilot
AI
changed the title
[WIP] Backport #127638 to fix assert in RestoreContextSimulated
[release/10.0] Backport #127638: Fix !m_RedirectContextInUse assert in RestoreContextSimulated on win-x86
Jul 17, 2026
Contributor
|
Tagging subscribers to this area: @agocke |
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.
main PR #127638
Description
On x86 Windows lacking
RtlRestoreContext,Thread::RestoreContextSimulatedcalledHandleThreadAbort()whilem_RedirectContextInUsewas stilltrue. Constructing theThreadAbortExceptionruns managed code, during which a concurrent GC redirect firesMarkRedirectContextInUse()and hits the!m_RedirectContextInUseassert (and can corrupt the saved context).Backport of #127638 to
release/10.0(src/coreclr/vm/threadsuspend.cpp, +10/-12):HandleThreadAbort()fromRestoreContextSimulated.#ifdef TARGET_X86RestoreContextSimulatedcall inRedirectedHandledJITCaseto after the existingCOMPlusCheckForAbort()block, so the x86 SEH path and theRtlRestoreContextpath share a single abort-check path.Byte-for-byte identical to the merged
mainfix except for preservingrelease/10.0's__UNREACHABLE()spelling.Customer Impact
Any x86 .NET 10 process where
ntdlllacksRtlRestoreContext(x86 Win7, WOW64 on Win7, and similar) can hit a double-redirect race that corrupts the saved thread context, causing random, hard-to-diagnose crashes. .NET 10 is LTS (supported through Nov 2028).Regression
No. Pre-existing bug in the x86
RestoreContextSimulatedpath, not introduced in a recent release.Testing
Manual review confirming the diff matches the merged
mainchange. The affected code is entirely under#ifdef TARGET_X86, so it is not exercised by non-Windows-x86 build/test configurations.Risk
Low. Minimal, localized reordering of an existing abort check; already reviewed and shipping on
mainsince 2026-05-01.Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.