[release/10.0] JIT: fix AV caused by JIT#121499
Merged
steveisok merged 1 commit intorelease/10.0from Nov 12, 2025
Merged
Conversation
The JIT attempts to deduce a class handle for the return type of TYP_REF calls, and almost always succeeds. However System.Array.Clone is special cased to return the type of its argument, and this argument may be a byref indir without a known managed type, so this deduction may fail. This causes the JIT to pass a null handle into the VM. Cope with this by setting the type instead of updating the type, if we discover it later via inlining. Closes #120522.
This was referenced Nov 10, 2025
Open
Member
|
@EgorBo can you PTAL |
EgorBo
approved these changes
Nov 11, 2025
Member
|
/ba-g Known issues #112633 dotnet/dnceng#6408 dotnet/dnceng#1883 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #120575 to release/10.0
/cc @AndyAyersMS
Customer Impact
Reported by customer in #120522
Regression
Similar problem exists in .NET 8 and .NET 9. I intend to backport this fix there if we fix this in .NET 10.
Testing
Verified on the test case from the issue.
Risk
Low. The JIT special cases return type deductions for
Array.Clone, and this issue only triggers if the argument toArray.Cloneis a byref. The fix is a bit more general but is mainly defensive, handling cases where return type deductions fail.