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

Fix exception leaking from filter in nativeAOT #85366

Merged

Conversation

janvorli
Copy link
Member

@janvorli janvorli commented Apr 25, 2023

There is a bug in handling exceptions that occur in exception filters in nativeAOT. If such exception is not handled in the filter, it needs to be swallowed and the filter should behave as if it returned false. Instead of that, the current behavior is that debug build of the runtime asserts and the release build fails fast without any message.

This change fixes it by catching the exception in the exception handling code. It was also necessary to modify the stack frame iterator to let it unwind past the filter funclet instead of failing fast.

Close dotnet/runtimelab#188

There is a bug in handling exceptions that occur in exception filters in
nativeAOT. If such exception is not handled in the filter, it needs to
be swallowed and the filter should behave as if it returned `false`.
Instead of that, the current behavior is that debug build of the runtime
asserts and the release build fails fast without any message.

This change fixes it by catching the exception in the exception handling
code. It was also necessary to modify the stack frame iterator to let it
unwind past the filter funclet instead of failing fast.
@janvorli janvorli added this to the 8.0.0 milestone Apr 25, 2023
@janvorli janvorli requested a review from jkotas April 25, 2023 22:17
@janvorli janvorli self-assigned this Apr 25, 2023
@ghost
Copy link

ghost commented Apr 25, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

There is a bug in handling exceptions that occur in exception filters in nativeAOT. If such exception is not handled in the filter, it needs to be swallowed and the filter should behave as if it returned false. Instead of that, the current behavior is that debug build of the runtime asserts and the release build fails fast without any message.

This change fixes it by catching the exception in the exception handling code. It was also necessary to modify the stack frame iterator to let it unwind past the filter funclet instead of failing fast.

Author: janvorli
Assignees: janvorli
Labels:

area-NativeAOT-coreclr

Milestone: 8.0.0

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

@janvorli
Copy link
Member Author

Test failure is a known issue: #84821

@janvorli janvorli merged commit 80ff9ee into dotnet:main Apr 28, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 29, 2023
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.

Handle throwing from an exception filter block
5 participants