alexcrichton opened PR #9304 from alexcrichton:print-async-stack-overflow
to bytecodealliance:main
:
This commit updates Wasmtime's handling of traps on Unix platforms to print an error message on stack overflow when the guard page is hit. This is distinct from stack overflow in WebAssembly which raises a normal trap and can be caught. This is instead to be used on misconfigured hosts where the async stack is too small or wasm was allowed to take up too much of the async stack. Currently no error message is printed and the program simply aborts with a core dump which can be difficult to debug.
This instead registers the range of the async guard page with the trap handling infrastructure to test the faulting address and if it lies within this range. If so then a small message is printed and then the program is aborted with
libc::abort()
.This does not impact the safety of any prior embedding or fix any issues. It's instead intended purely as a diagnostic tool to help users more quickly understand that stack size configuration settings are the likely culprit.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested elliottt for a review on PR #9304.
alexcrichton requested wasmtime-core-reviewers for a review on PR #9304.
alexcrichton commented on PR #9304:
This is inspired by https://github.com/bytecodealliance/wasmtime/issues/9298 where stack overflows on the CLI in async fibers might be more common now.
alexcrichton updated PR #9304.
alexcrichton updated PR #9304.
alexcrichton updated PR #9304.
alexcrichton updated PR #9304.
alexcrichton updated PR #9304.
elliottt submitted PR review:
This all seems reasonable to me!
alexcrichton merged PR #9304.
Last updated: Dec 23 2024 at 12:05 UTC