Uh oh!
There was an error while loading. Please reload this page.
Closed
Remove RtlRestoreContext fallback paths for legacy x86 Windows; use static linking like all other architectures#131013
Conversation
|
Azure Pipelines: 16 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: @agocke |
Remove RestoreContextSimulated and RtlRestoreContextFallback fallback paths that were used to simulate RtlRestoreContext on legacy x86 Windows OSes (pre-Vista). These OSes are no longer supported. - Remove g_pfnRtlRestoreContext global and GetProcAddress lookup from ceemain.cpp and vars.hpp - Remove RestoreContextSimulated declaration from threads.h - Remove RedirectedHandledJITCaseExceptionFilter and RestoreContextSimulated implementation from threadsuspend.cpp - Replace g_pfnRtlRestoreContext conditional call with direct RtlRestoreContext call (matching AMD64/ARM/ARM64 path) - Remove RtlRestoreContextFallback, RtlRestoreContextFallbackExceptionFilter, and associated SEH helpers from NativeAOT PalMinWin.cpp - Remove pfnRtlRestoreContext function pointer and GetProcAddress lookup from PalMinWin.cpp - Simplify PalRestoreContext to call RtlRestoreContext directly Fixes#131010 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
CopilotAI
changed the title
[WIP] Fix CopyContext failure in RestoreContextSimulated path on Windows 7Remove RtlRestoreContext fallback paths for legacy x86 Windows; use static linking like all other architecturesJul 18, 2026
jkotas
commented
Jul 18, 2026
Member
RtlRestoreContext is only available since Windows 10 21H2 (Ferrum). We still support older versions than that https://github.com/dotnet/core/blob/main/release-notes/11.0/supported-os.md#windows , so this cannot be deleted yet. |
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 freeto 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.
The x86-only
RestoreContextSimulated/RtlRestoreContextFallbackcode paths — which simulatedRtlRestoreContextvia SEH on pre-Vista Windows — were never removed when Windows 7 support was dropped. These paths are the root cause of the reported fatal crash. The fix removes them entirely and callsRtlRestoreContextdirectly on x86, matching the existing AMD64/ARM/ARM64 behavior.Changes
CoreCLR VM (
src/coreclr/vm/)ceemain.cpp,vars.hpp: Removeg_pfnRtlRestoreContextglobal and theGetProcAddress(ntdll, "RtlRestoreContext")dynamic lookupthreads.h: RemoveRestoreContextSimulateddeclarationthreadsuspend.cpp: RemoveRedirectedHandledJITCaseExceptionFilterandRestoreContextSimulatedimplementations; replace the x86/non-x86 conditional call with a single directRtlRestoreContext(pCtx, NULL)NativeAOT (
src/coreclr/nativeaot/Runtime/windows/PalMinWin.cpp)RtlRestoreContextFallback,RtlRestoreContextFallbackExceptionFilter, and the local SEH helpers (GetCurrentSEHRecord,SetCurrentSEHRecord,PopSEHRecords) that existed only to support the fallbackpfnRtlRestoreContextfunction pointer and itsGetProcAddressinitializationPalRestoreContextto callRtlRestoreContextdirectly (dropping the x86 conditional)