Skip to content

[release/9.0] Fix memory corruption bug in virtual static method dispatch - #107776

Merged
jeffschwMSFT merged 2 commits into
release/9.0from
backport/pr-107763-to-release/9.0
Sep 13, 2024
Merged

[release/9.0] Fix memory corruption bug in virtual static method dispatch#107776
jeffschwMSFT merged 2 commits into
release/9.0from
backport/pr-107763-to-release/9.0

Conversation

@github-actions

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

Copy link
Copy Markdown
Contributor

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
@ghost ghost added the area-VM-coreclr label Sep 13, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@jeffschwMSFT jeffschwMSFT left a comment

Copy link
Copy Markdown
Member

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
@jkotas
jkotas deleted the backport/pr-107763-to-release/9.0 branch September 13, 2024 16:18
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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