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

Fix UMEntryThunkCache::GetUMEntryThunk #55834

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

janvorli
Copy link
Member

The function was initializing UMThunkMarshInfo allocated from Stub heap
without using the ExecutableWriterHolder. That causes a crash when a
hosting application calls coreclr_create_delegate.
This was discovered in .NET 6 Preview 6 when running a xamarin app that
uses a special host.

This code path is exercised only by coreclr_create_delegate.

Close #55773

The function was initializing UMThunkMarshInfo allocated from Stub heap
without using the ExecutableWriterHolder. That causes a crash when a
hosting application calls coreclr_create_delegate.
This was discovered in .NET 6 Preview 6 when running a xamarin app that
uses a special host.

This code path is exercised only by coreclr_create_delegate.
@janvorli janvorli added this to the 6.0.0 milestone Jul 16, 2021
@janvorli janvorli requested a review from jkotas July 16, 2021 15:26
@janvorli janvorli self-assigned this Jul 16, 2021
@jkotas
Copy link
Member

jkotas commented Jul 16, 2021

There is nothing executable in UMThunkMarshInfo . Why are we allocating it on executable heap in the first place?

@janvorli
Copy link
Member Author

Why are we allocating it on executable heap in the first place

I think the reason was that before my changes, the UMThunkMarshInfo was being allocated from two heaps. From regular C heap and from the thunk heap in Module. I needed to unify it so that at some place I don't need to somehow detect which one it was when a write to it was needed. I am not sure if it was even reasonable to detect which one it was. And somehow moving the one in the Module to C heap was complicated, IIRC.
The thing is that I have a local change from before that moved this whole UMEntryThunk related stuff to the new way of splitting executable and RW data into separate pages that I want to add post 6. So I just kept it simple.

@janvorli janvorli merged commit 57c4e7e into dotnet:main Jul 16, 2021
@janvorli janvorli deleted the fix-getumentrythunk branch July 16, 2021 17:35
@janvorli
Copy link
Member Author

/backport to release/6.0-preview7

@github-actions
Copy link
Contributor

Started backporting to release/6.0-preview7: https://github.com/dotnet/runtime/actions/runs/1038308232

@ghost ghost locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.NET 6 Preview 6 breaks net6.0-macos / osx-arm64
2 participants