Skip to content

Backport stack trace panic fix to 0.40#4834

Merged
fitzgen merged 3 commits into
bytecodealliance:release-0.40.0from
fitzgen:backport-stack-trace-panic-to-0.40
Aug 31, 2022
Merged

Backport stack trace panic fix to 0.40#4834
fitzgen merged 3 commits into
bytecodealliance:release-0.40.0from
fitzgen:backport-stack-trace-panic-to-0.40

Conversation

@fitzgen
Copy link
Copy Markdown
Member

@fitzgen fitzgen commented Aug 31, 2022

This backports ff0e84e (and a change to silence a build warning that could break CI) to the release-0.40.0 branch.

…codealliance#4779)

We were previously implicitly assuming that all Wasm frames in a stack used the
same `VMRuntimeLimits` as the previous frame we walked, 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 the `CallThreadState` linked list by making the
`CallThreadState::prev` field private and only accessible via a getter and
setter, where the setter always maintains our invariants.
@fitzgen fitzgen requested a review from alexcrichton August 31, 2022 18:54
@github-actions github-actions Bot added wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:docs Issues related to Wasmtime's documentation labels Aug 31, 2022
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @peterhuene

Details This issue or pull request has been labeled: "wasmtime:api", "wasmtime:docs"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@fitzgen fitzgen merged commit 4c5a310 into bytecodealliance:release-0.40.0 Aug 31, 2022
@fitzgen fitzgen deleted the backport-stack-trace-panic-to-0.40 branch August 31, 2022 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:docs Issues related to Wasmtime's documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants