fitzgen opened PR #4779 from stack-trace-panic
to main
:
We were previously implicitly assuming that all Wasm frames in a stack used the same
VMRuntimeLimits
as the previous frame'sCallThreadState
, but this is not true when Wasm in store A calls into the host which then calls into Wasm in store B:| ... | | Host | | +-----------------+ | stack | Wasm in store A | | grows +-----------------+ | down | Host | | +-----------------+ | | Wasm in store B | V +-----------------+
Trying to walk this stack would previously result in a runtime panic.
The solution is to push the maintenance of our list of saved Wasm FP/SP/PC registers that allow us to identify contiguous regions of Wasm frames on the stack deeper into
CallThreadState
. The saved registers list is now maintained whenever updating theCallThreadState
linked list by making theCallThreadState::prev
field private and only accessible via a getter and setter, where the setter always maintains our invariants.Thanks to @bnjbvr for reporting this bug!
@cfallin do you feel familiar enough with this stuff that you'd be comfortable reviewing it? If not, I can totally wait for Alex to come back from PTO.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
fitzgen requested cfallin for a review on PR #4779.
fitzgen requested alexcrichton for a review on PR #4779.
alexcrichton submitted PR review.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
This may have gone a bit awry
fitzgen updated PR #4779 from stack-trace-panic
to main
.
fitzgen created PR review comment:
Whoops...
fitzgen submitted PR review.
fitzgen has enabled auto merge for PR #4779.
fitzgen merged PR #4779.
Last updated: Dec 23 2024 at 12:05 UTC