Skip to content

[release/6.0] Port #58410: Fix zero initialization use of "initReg" - #62207

Merged
safern merged 1 commit into
dotnet:release/6.0from
BruceForstall:Port58410
Dec 15, 2021
Merged

[release/6.0] Port #58410: Fix zero initialization use of "initReg"#62207
safern merged 1 commit into
dotnet:release/6.0from
BruceForstall:Port58410

Conversation

@BruceForstall

@BruceForstallBruceForstall commented Nov 30, 2021

Copy link
Copy Markdown
Contributor

Backport #58410 to release/6.0

Fixes#62103

Customer Impact

Silent bad codegen: in certain rare cases, a variable is not correctly zero initialized, possibly leading to incorrect results or crashes. Typically, this requires a single local variable that is a register-sized struct, marked as requiring zero initialization by the JIT.

The issue was originally found with internal "stress" testing late in .NET 6 product development, but the fix was not ported to the .NET 6 release branch. However, it was subsequently reported by an external F# customer on the 6.0 release.

This was a regression between .NET 5 and .NET 6 due to extensive struct optimization work in the JIT.

Testing

The fix has been in 'main' for 3 months, but wasn't ported to release/6.0 before release.

Risk

Low

…Reg"
If the only local is an enregistered must-init struct,
we were setting `initReg` to its register (in this case, `xmm0`).
However, `initReg` is expected to be an integer register. In the
test case, with GS cookie stress, the GS cookie code asserted
that `initReg` was an integer register, but it wasn't.
The fix is the change the condition to use the actual register
assigned to the variable (in this case, `xmm0`), not the variable
type (here, `TYP_STRUCT`).
No spmi asm diffs.
Fixesdotnet#57911
@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 30, 2021
@ghost

Copy link
Copy Markdown

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

Issue Details

Backport #58410 to release/6.0

Customer Impact

Silent bad codegen: in certain rare cases, a variable is not correctly zero initialized, possibly leading to incorrect results or crashes.

The issue was originally found with internal "stress" testing, but was reported by an external F# customer on the 6.0 release.

Testing

The fix has been in 'main' for 3 months, but wasn't ported to release/6.0 before release.

Risk

Low

Author:BruceForstall
Assignees:-
Labels:

area-CodeGen-coreclr

Milestone:-

@BruceForstall

Copy link
Copy Markdown
ContributorAuthor

@jakobbotsch @dotnet/jit-contrib PTAL: back-port of fix to .NET 6

@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. We will take for consideration in 6.0.x

@jeffschwMSFTjeffschwMSFT added the Servicing-consider Issue for next servicing release review label Dec 1, 2021
@jeffschwMSFTjeffschwMSFT added this to the 6.0.x milestone Dec 1, 2021
@PilchiePilchie added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Dec 2, 2021
@PilchiePilchie modified the milestones: 6.0.x, 6.0.2Dec 2, 2021
@safern
safern merged commit 229abfc into dotnet:release/6.0Dec 15, 2021
@BruceForstall
BruceForstall deleted the Port58410 branch December 15, 2021 18:52
@ghostghost locked as resolved and limited conversation to collaborators Jan 14, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@BruceForstall@jakobbotsch@jeffschwMSFT@AndyAyersMS@Pilchie@safern