Skip to content

[release/6.0] Fix Unix ARM64 RtlRestoreContext implementation - #59849

Merged
jeffschwMSFT merged 1 commit into
release/6.0from
backport/pr-59831-to-release/6.0
Oct 4, 2021
Merged

[release/6.0] Fix Unix ARM64 RtlRestoreContext implementation#59849
jeffschwMSFT merged 1 commit into
release/6.0from
backport/pr-59831-to-release/6.0

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Oct 1, 2021

Copy link
Copy Markdown
Contributor

Backport of #59831 to release/6.0

/cc @jkotas@janvorli

Customer Impact

Linux ARM64 reliability. Hard to diagnose crash (jump to a random IP read from overwritten memory) triggered by specific interleaving of exception thrown on one thread and GC suspension executing on a second thread.

The bug was tracked to a crash that is observed in dotnet/runtime CI in System.Text.Json tests every few days (#57198). There are likely other crashes caused by this bug.

Testing

Standard dotnet/runtime CI pass.

Risk

Minimal. One-liner fix. Code path is exercised on every exception thrown.

The RtlRestoreContext sets SP before reading out PC from the
context. That can lead to a corruption of the PC in the context
if an async signal is delivered to the thread or the thread is
interrupted by any other mean after the SP is set and before
the value of PC is extracted from the context.
This change fixes it by setting the SP after both PC and SP values
are read from the context data structure.
@ghostghost added the area-PAL-coreclr only for closed issues label Oct 1, 2021

@jeffschwMSFTjeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Let's strive for a green CI and we should take for consideration in .NET 6.

@jeffschwMSFTjeffschwMSFT added the Servicing-approved Approved for servicing release label Oct 1, 2021
@jeffschwMSFTjeffschwMSFT added this to the 6.0.0 milestone Oct 1, 2021
@jeffschwMSFT
jeffschwMSFT merged commit ebaef9c into release/6.0Oct 4, 2021
@akoeplinger
akoeplinger deleted the backport/pr-59831-to-release/6.0 branch October 7, 2021 18:37
@ghostghost locked as resolved and limited conversation to collaborators Nov 6, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-PAL-coreclronly for closed issuesServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jkotas@jeffschwMSFT@janvorli