fitzgen opened PR #6321 from fitzgen:save-restore-stack-walking-registers
to bytecodealliance:main
:
Fixes a regression from #6262, originally reported in https://github.com/bytecodealliance/wasmtime-dotnet/pull/245
The issue was that we would enter Wasm and save the stack-walking registers but never clear them after Wasm returns. Then if a host-to-host call tried to capture a stack, we would mistakenly attempt to use those stale registers to start the stack walk. This mistake would be caught by an assertion, triggering a panic.
This commit fixes the issue by managing the save/restore in the
CallThreadState
construction/drop, rather than in the oldset_prev
method.<!--
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
-->
fitzgen requested jameysharp for a review on PR #6321.
fitzgen requested wasmtime-core-reviewers for a review on PR #6321.
alexcrichton submitted PR review.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
(in async for example minimizing hits to tls can be somewhat important)
alexcrichton created PR review comment:
This might be good to tighten up as
self.prev.set(tls::raw::replace(self))
perhaps?
fitzgen updated PR #6321.
fitzgen has enabled auto merge for PR #6321.
fitzgen updated PR #6321.
alexcrichton submitted PR review.
fitzgen merged PR #6321.
Last updated: Dec 23 2024 at 12:05 UTC