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/6.0] Fix crossgen2 calli GC hole by unifying MethodDesc/MethodSignature IsMarshallingRequired logic #58609

Merged
merged 3 commits into from
Sep 3, 2021

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 3, 2021

Backport of #58430 to release/6.0

/cc @jakobbotsch

Customer Impact

Crossgenning code that uses unmanaged function pointers with managed references may lead to codegen that does not pin those references around the unmanaged call. This leads to GC holes/memory corruption.

Testing

There is a regression test included. The test case asserts before this change because the JIT is confused about the passing of a byref to an unmanaged call.

Risk

Low, this unifies the existing correct pinvoke check (used for standard pinvoke) with the one used for unmanaged function pointers (that was incorrect).

For unmanaged calli crossgen2 was not properly checking all necessary
conditions for a pinvoke being required. In particular it did not check
for managed byrefs. Unify the MethodDesc/MethodSignature logic to get
all the checks.

Fix #58259
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 3, 2021
@ghost
Copy link

ghost commented Sep 3, 2021

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

Issue Details

Backport of #58430 to release/6.0

/cc @jakobbotsch

Customer Impact

Testing

Risk

Author: github-actions[bot]
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@JulieLeeMSFT
Copy link
Member

cc @jeffschwMSFT for backport to 6.0.

@JulieLeeMSFT JulieLeeMSFT added this to the 6.0.0 milestone Sep 3, 2021
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. Please get a code review and once we have a green ci we can merge.

@jeffschwMSFT jeffschwMSFT merged commit 69b137a into release/6.0 Sep 3, 2021
@jakobbotsch jakobbotsch deleted the backport/pr-58430-to-release/6.0 branch September 3, 2021 18:45
@ghost ghost locked as resolved and limited conversation to collaborators Oct 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants