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/5.0] Remove the sealed blittable layoutclass correctness fix because of backcompat. #54244

Merged
merged 2 commits into from
Jul 8, 2021

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Jun 15, 2021

Port of #54235

Customer Impact

Copying data for a non-sealed blittable layout class instead of pinning leads to a use-after-free bug of code on the native heap in NAudio on .NET 5.0.7.

NAudio pins the layoutclass object in managed code and uses the same memory address across multiple native calls. When the fix in #50882 changed the layoutclass marshaller to have some extra safety and not pass non-sealed blittable layout classes by pinning and instead allocate memory and copy, the assumption NAudio made around the object's native representation's address being constant while the managed object is pinned with a pinned GC handle became untrue.

Testing

Testing added in PR.

Fix validated by users.

Risk

Low. This puts our behavior fully 100% in line with 3.1 for our layout class marshalling with no observable differences in behavior for any scenario we know about. I know I said the same thing in #50882, but at the time I did not realize that there was a mechanism to become dependent on the pinning optimization occurring outside of the data marshalling around the call (which #50882 included compat behavior to preserve).

Regression

This is a regression introduced in #50882

@jeffschwMSFT
Copy link
Member

@jkoritzinsky looks like part of the ci failure is related to the discussion here: dotnet/sdk#18292. Please resolve the other issues and get a cr.

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. Will take for consideration in 5.0.x

@jeffschwMSFT jeffschwMSFT added the Servicing-consider Issue for next servicing release review label Jun 16, 2021
@jkoritzinsky
Copy link
Member Author

The test failures are #11063

@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Jun 22, 2021
@leecow leecow modified the milestones: 5.0.x, 5.0.9 Jun 22, 2021
@Anipik Anipik merged commit 9b6d3ab into dotnet:release/5.0 Jul 8, 2021
@jkoritzinsky jkoritzinsky deleted the fixes/5.0/54132 branch July 8, 2021 22:12
@ghost ghost locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Interop-coreclr Servicing-approved Approved for servicing release
Projects
None yet
5 participants