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] JIT: remove incorrect type deduction for an Unsafe.As case #93703

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 18, 2023

Backport of #93694 to release/8.0

/cc @AndyAyersMS

Customer Impact

Regression from prior releases, reported by @pentp in #93650.

In some uncommon cases using Unsafe.As on a reference to a value class struct field, the JIT may use the type of the field as the type, instead of the cast-to type.

Testing

Verified repro case is now fixed, no diffs in SPMI.

Risk

Low. This is a fairly surgical fix and makes the JIT more conservative.

Thanks to @SingleAccretion for the fix.

The JIT was assuming that an indirectly accessed value type field had
the type of the field, but that might not be the case if the field
was accessed via `Unsafe.As`.

Fix this by limiting type deduction from these indirectly accessed fields
to only ref type fields.

Closes #93650.
@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 Oct 18, 2023
@ghost
Copy link

ghost commented Oct 18, 2023

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

Issue Details

Backport of #93694 to release/8.0

/cc @AndyAyersMS

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: -

@AndyAyersMS
Copy link
Member

@jakobbotsch PTAL
cc @dotnet/jit-contrib @jeffschwMSFT

Would like to consider this for .NET 8.

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 for 8.0.x

@jeffschwMSFT jeffschwMSFT added the Servicing-consider Issue for next servicing release review label Oct 19, 2023
@jeffschwMSFT jeffschwMSFT added this to the 8.0.0 milestone Oct 19, 2023
@jeffschwMSFT jeffschwMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 20, 2023
@carlossanlop
Copy link
Member

Failure unrelated - test timeout:

   System.Security.Cryptography.OpenSsl.Tests: [Long Running Test] 'System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.ReadEncryptedRsa16384', Elapsed: 00:02:09
['System.Security.Cryptography.OpenSsl.Tests' END OF WORK ITEM LOG: Command timed out, and was killed]

@carlossanlop carlossanlop merged commit 86c9493 into release/8.0 Oct 20, 2023
118 of 124 checks passed
@carlossanlop carlossanlop deleted the backport/pr-93694-to-release/8.0 branch October 20, 2023 00:12
@ghost ghost locked as resolved and limited conversation to collaborators Nov 19, 2023
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

4 participants