Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0-staging] GT_STORE_BLK - do not call memset for blocks containg gc pointers on heap #96514

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jan 4, 2024

Backport of #95530 to release/8.0-staging

/cc @EgorBo

Customer Impact

When jit needed to zero a struct with gc references it used to emit a call to an internal helper JIT_MemSet that didn't have atomicity guarantees and could lead to torn values if GC happened during that memset. This issue was present from .NET core 3.

Example:

void Test(ref LargeStructWithGC s)
{
    s = default; // GC may stop during this zeroing and read `a` field which might be half-zeroed.
}

struct LargeStructWithGC
{
    long b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, r, s, t, u, v, w, z;
    string a;
}

The PR fixes that issue by inlining memset so we can 100% guarantee atomicity by using correct instructions.
The original issue was found via internal escalation (service crashing 3x per day).

Testing

Local testing + stress/outerloop jobs

Risk

Low. It is not a common case. It happens for a big struct with GC types. Even our SPMI has very few of these cases.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 4, 2024
@ghost
Copy link

ghost commented Jan 4, 2024

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

Issue Details

Backport of #95530 to release/8.0-staging

/cc @EgorBo

Customer Impact

Testing

Risk

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

Copy link
Member

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

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

LGTM

You should probably run outerloop and jitstress jobs to ensure the 8.0 sources haven't diverged in important ways from main.

@EgorBo
Copy link
Member

EgorBo commented Jan 5, 2024

/azp run runtime-coreclr outerloop, runtime-coreclr jitstress

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@carlossanlop
Copy link
Member

@EgorBo Friendly reminder that Tuesday January 16th 4pm is the Code Complete deadline for the February Release. If all requirements are met, please merge your PR before that date and time to ensure this fix gets included in that Release.

@JulieLeeMSFT
Copy link
Member

@jeffschwMSFT, please consider this for approval.

@JulieLeeMSFT JulieLeeMSFT added the Servicing-consider Issue for next servicing release review label Jan 12, 2024
@JulieLeeMSFT JulieLeeMSFT added this to the 8.0.x milestone Jan 12, 2024
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. we will take for consideration in 8.0.x

@jeffschwMSFT jeffschwMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Jan 13, 2024
@jeffschwMSFT jeffschwMSFT modified the milestones: 8.0.x, 8.0.2 Jan 13, 2024
@jeffschwMSFT jeffschwMSFT merged commit 46adbbb into release/8.0-staging Jan 13, 2024
204 of 210 checks passed
@jkotas jkotas deleted the backport/pr-95530-to-release/8.0-staging branch January 20, 2024 03:19
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants