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

Terminate the process if the callback exception handler throws another exception #188

Conversation

kpreisser
Copy link
Contributor

@kpreisser kpreisser commented Nov 19, 2022

Terminate the process with Environment.FailFast() if the callback exception handler throws another exception, to ensure we don't let .NET exceptions bubble through the native-to-managed transition (which would be possible at least on Windows), as that causes undefined behavior with Wasmtime.

On Linux, the application will already crash consistently in such a case, so this makes the behavior on Windows consistent with the one on Linux.

Fixes #187

What do you think?
Thanks!

…r exception, to ensure we don't let .NET exceptions fall through the native-to-managed transition.

Fixes bytecodealliance#187
@peterhuene peterhuene self-requested a review November 28, 2022 19:06
Copy link
Member

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

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

Looks good!

@peterhuene peterhuene merged commit 1869265 into bytecodealliance:main Nov 28, 2022
@kpreisser kpreisser deleted the prevent-exceptions-from-falling-through-callback branch November 28, 2022 19:21
kpreisser added a commit to kpreisser/wasmtime-dotnet that referenced this pull request Dec 3, 2022
…ally throw an OOM due to the allocation that we need to catch.

This is a follow-up to PR bytecodealliance#188.
peterhuene pushed a commit that referenced this pull request Dec 6, 2022
…ally throw an OOM due to the allocation that we need to catch. (#193)

This is a follow-up to PR #188.
kpreisser added a commit to kpreisser/wasmtime-dotnet that referenced this pull request Dec 9, 2022
…to store the `Store` itself as context data, so that we can access it in function callbacks.

This allows us to create a `funcref` value as `Function` using the associated `Store` instead of the `Caller`, so that it can be stored and then called outside of the callback.

Fixes bytecodealliance#200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undefined behavior when callback exception handler throws another exception
2 participants