Skip to content

Conversation

janvorli
Copy link
Member

I've started to hit a problem with the interpreter when a CodeHeap pointer obtained from the m_pLastUsedInterpreterDynamicCodeHeap was invalid.
This issue is that we were missing cleanup of that cached code heap pointer when the code heap was destroyed.

This change adds the cleanup in the same way it is done for non-interpreter dynamic code heap.

I've started to hit a problem with the interpreter when a CodeHeap
pointer obtained from the m_pLastUsedInterpreterDynamicCodeHeap
was invalid.
This issue is that we were missing cleanup of that cached code heap
pointer when the code heap was destroyed.

This change adds the cleanup in the same way it is done for
non-interpreter dynamic code heap.
@janvorli janvorli added this to the 11.0.0 milestone Aug 29, 2025
@janvorli janvorli self-assigned this Aug 29, 2025
@Copilot Copilot AI review requested due to automatic review settings August 29, 2025 11:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a critical memory safety issue in the CoreCLR interpreter where a cached code heap pointer remained valid after the underlying code heap was destroyed, leading to potential use-after-free scenarios.

  • Adds proper cleanup of the cached interpreter dynamic code heap pointer when a code heap is removed
  • Mirrors the existing cleanup pattern used for non-interpreter dynamic code heaps

Copy link
Contributor

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

@janvorli janvorli merged commit b2c0e89 into dotnet:main Sep 2, 2025
98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants