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] [mono] Copy image data with AssemblyLoadContext.LoadFromStream #43593

Merged
merged 1 commit into from
Oct 20, 2020

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 19, 2020

Backport of #43592 to release/5.0

/cc @CoffeeFlux

Customer Impact

Fix was prompted by a customer bug report at #43402

This bug will affect anyone using AssemblyLoadContext.LoadFromStream on wasm with enough other data in the LOH to trigger a GC, so the potential for others to hit this seems high in real applications despite it not showing up in testing.

Testing

Manually validated against the attached repro. Problem goes away even after 10 iterations, when previously the corruption would be evident on the first.

Risk

Low. This is just a one-line change that ensure we copy the data locally into non-managed memory. The copying functionality is hit regularly multiple other places in the runtime in addition to being fairly simple, so it is unlikely to cause problems. In a .NET 5 context, this fix is wasm-specific.

We don't actually pin the byte array, so it must be copied or it can be overwritten once we run a GC on the LOH.

Fixes #43402

Tested manually that it fixes the issue using the associated repro. This isn't really something that lends itself to a test, so that's the best I can do.
@ghost
Copy link

ghost commented Oct 19, 2020

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

@lewing lewing added arch-wasm WebAssembly architecture Servicing-consider Issue for next servicing release review labels Oct 19, 2020
@lewing
Copy link
Member

lewing commented Oct 19, 2020

This codepath is used by the lazy assembly loading Blazor feature.

@lewing lewing added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 19, 2020
@lewing
Copy link
Member

lewing commented Oct 19, 2020

Approved in tactics.

@lewing
Copy link
Member

lewing commented Oct 19, 2020

Browser failure is #43589 with missing #43598

Copy link
Member

@lewing lewing left a comment

Choose a reason for hiding this comment

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

build #20201019.30
Mono runtime specific change,

apple failures are SDK install failures #43626
Windows cancellations are unrelated.

@lewing lewing merged commit 39adc83 into release/5.0 Oct 20, 2020
@lewing lewing deleted the backport/pr-43592-to-release/5.0 branch October 20, 2020 01:20
@mmitche mmitche added this to the 5.0.1 milestone Nov 3, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-AssemblyLoader-mono Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants