Skip to content

[release/9.0] JIT: don't create vector constants from relocatable constants#107500

Merged
jeffschwMSFT merged 3 commits intorelease/9.0from
backport/pr-107491-to-release/9.0
Sep 11, 2024
Merged

[release/9.0] JIT: don't create vector constants from relocatable constants#107500
jeffschwMSFT merged 3 commits intorelease/9.0from
backport/pr-107491-to-release/9.0

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Sep 7, 2024

Backport of #107491 to release/9.0

/cc @AndyAyersMS

Customer Impact

  • Customer reported
  • Found internally

#107396

The JIT can coalesce adjacent scalar stores into a single vector store. If the values being stored are constant, then the value being stored is usually not expressible as a literal (in-code) constant and so the JIT will allocate a data segment for the constant.

However, certain constants (like function addresses) may be relocatable and need adjustment at link or load time, and there is currently no mechanism to report relocations for JIT-created data segments.

As a result, programs relying on these constants may crash, compute the wrong values, try and jump to somewhat arbitrary addresses, etc.

This fix blocks the jit from coalescing stores for relocatable constants.

Regression

  • Yes
  • No

Store coalescing is new in .NET 9: #92852

Testing

Verified on test case from the issue.

Risk

Low. The fix stops the jit from doing an optional optimization, reverting for those cases to .NET 8 behavior.

We can't represent relocations in data currently.

Fixes #107396.
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 7, 2024
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@AndyAyersMS
Copy link
Copy Markdown
Member

FYI @JulieLeeMSFT @jeffschwMSFT

@AndyAyersMS AndyAyersMS added the Servicing-consider Issue for next servicing release review label Sep 7, 2024
@teo-tsirpanis teo-tsirpanis added this to the 9.0.0 milestone Sep 8, 2024
Copy link
Copy Markdown
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 can merge when ready

@jeffschwMSFT jeffschwMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 9, 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.

4 participants