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/9.0] Fix memory corruption bug in virtual static method dispatch #107776

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

github-actions[bot]
Copy link
Contributor

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

Backport of #107763 to release/9.0

/cc @davidwrighton

Customer Impact

  • Customer reported
  • Found internally

This bug impacts customers who use the static virtual method feature in combination with interface variance. The only known repro today also requires default interface implementations. The failure mode for customers is memory corruption caused by access to the GC heap which is not synchronized with the GC. This was found when adjusting the runtime in .NET 10 to use a slightly different code path which exposed the bug in many more situations.

Regression

  • Yes
  • No

[If yes, specify when the regression was introduced. Provide the PR or commit if known.]

Testing

Newly written regression test, PR testing.

Risk

Low. The change calls a function which is already called in similar situations, and which is capable of doing the correct synchronization with the GC.

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.

- Use `TypeHandle::CanCastTo` instead of `MethodTable::CanCastTo`
  - The issue is that the `MethodTable` api requires cooperative mode, and the `TypeHandle` supports either mode

Fixes #107754
Copy link
Contributor

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

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 can merge when ready

@jeffschwMSFT jeffschwMSFT added the Servicing-approved Approved for servicing release label Sep 13, 2024
@jeffschwMSFT jeffschwMSFT merged commit 2081c29 into release/9.0 Sep 13, 2024
10 checks passed
@jkotas jkotas deleted the backport/pr-107763-to-release/9.0 branch September 13, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-VM-coreclr Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants