Skip to content

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 1, 2021

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.
@ghost ghost added the area-PAL-coreclr label Oct 1, 2021
Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

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.

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

Labels

area-PAL-coreclr Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants