Skip to content

[release/11.0] JIT: Fix null class handle in gtCanSkipCovariantStoreCheck - #138551

Open
EgorBo wants to merge 2 commits into
dotnet:release/11.0from
EgorBo:backport-138206-release-11.0
Open

EgorBo wants to merge 2 commits into
dotnet:release/11.0from
EgorBo:backport-138206-release-11.0

Conversation

@EgorBo

@EgorBo EgorBo commented Nov 30, 2026

Copy link
Copy Markdown
Member

Fixes Issue #138142

main PR #138206

Description

Backport of #138206 to release/11.0. With PGO, a guessed delegate target can be inlined where it can never be right. gtCanSkipCovariantStoreCheck then passed a null element handle (array of primitives) to isExactType. The fix bails out early when the element type is not a class or the handle is null.

Customer Impact

  • Customer reported
  • Found internally

The JIT crashes (SIGSEGV) on the tiering background thread and the process dies. No unsafe code is needed.

Regression

  • Yes
  • No

Works on .NET 8 and 9, crashes on 10.0 and 11.0.

Testing

Test is backported.

Risk

Low. Adds an early bail-out, no diffs in main.

Note

PR description generated with GitHub Copilot.

EgorBo and others added 2 commits November 30, 2026 23:35
…8206)

Fixes dotnet#138142

With PGO, a guessed delegate target can be inlined where it can never be
right. In the repro, the inlinee does `stelem.ref` while the JIT sees
the array as `int[]`. `getChildType` returns a null element handle for
arrays of primitives, and `gtCanSkipCovariantStoreCheck` passed that to
`isExactType` before checking for `NO_CLASS_HANDLE`. In Checked builds,
the assert fired instead.

Replace the assert with an early bail-out when the element type isn't
`CORINFO_TYPE_CLASS` or the handle is null.

[No
diffs](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1697078&view=ms.vss-build-web.run-extensions-tab)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a77cc625-7a0c-4ac8-813a-8b0d25807906
(cherry picked from commit 73448b0)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8c6b9802-8643-479e-bbb4-f4e04e60fc0a
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 30, 2026
@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.

@EgorBo
EgorBo requested a review from AndyAyersMS November 30, 2026 22:47

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants