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-rc1] Fix IL corruption (#2213) #2219

Merged
merged 1 commit into from
Aug 24, 2021

Conversation

agocke
Copy link
Member

@agocke agocke commented Aug 19, 2021

Backport of #2213 to release/6.0-rc1

Customer Impact

Fixes IL corruption issues seen in dotnet/runtime. In many cases the invalid IL is accepted by the .NET runtime, but there may be cases where the runtime cannot JIT or produces incorrect machine code. Other runtimes, like Mono AOT, fail outright.

Testing

Unit tests, manual verification.

Risk

Low. The fix is constrained to fixing up scopes and branches. Cecil already doesn't handle this properly and the IL produced by a bug in the custom processor is unlikely to be worse than the IL Cecil already produces.

…otnet#2213)

Cecil doesn't handle IL editing well. It doesn't patch scopes and branches. Added a linker-private IL processor which does this.

Added tests for the IL corruption when removing branches around code which has exception handlers.

I also removed now unnecessary test attribute, since in my previous change the exception handlers are now validated within the instruction stream, so no need for a second attribute to validate these.

Co-authored-by: Sven Boemer <[email protected]>
(cherry picked from commit e9403e2)
@agocke agocke added this to the .NET 6.0 milestone Aug 19, 2021
@agocke agocke requested review from vitek-karas and removed request for marek-safar August 19, 2021 21:59
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. We should consider this for RC1/RC2

@agocke agocke changed the title [release/6.0-rc1] Backport #2213 [release/6.0-rc1] Fix IL corruption (#2213) Aug 24, 2021
@agocke
Copy link
Member Author

agocke commented Aug 24, 2021

Merging -- we'll review this in the runtime integration PR

@agocke agocke merged commit edad7cb into dotnet:release/6.0 Aug 24, 2021
@agocke agocke deleted the backport-2213 branch August 24, 2021 17:07
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.

3 participants