Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

[release/6.0-rc1] Fix IL corruption (#2213) - #2219

Merged
agocke merged 1 commit into
dotnet:release/6.0from
agocke:backport-2213
Aug 24, 2021
Merged

agocke merged 1 commit into
dotnet:release/6.0from
agocke:backport-2213

Conversation

@agocke

@agocke agocke commented Aug 19, 2021 •

Copy link
Copy Markdown
Member

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 a review from marek-safar as a code owner August 19, 2021 21:59
@agocke
agocke requested review from vitek-karas and removed request for marek-safar August 19, 2021 21:59

@jeffschwMSFT jeffschwMSFT left a comment

Copy link
Copy Markdown
Member

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

agocke commented Aug 24, 2021

Copy link
Copy Markdown
Member Author

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 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.

3 participants