Stream: git-wasmtime

Topic: wasmtime / PR #4779 Wasmtime: fix stack walking across fr...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 24 2022 at 23:50):

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's CallThreadState, 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.

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.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Aug 24 2022 at 23:50):

fitzgen requested cfallin for a review on PR #4779.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 24 2022 at 23:50):

fitzgen requested alexcrichton for a review on PR #4779.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2022 at 14:15):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2022 at 14:15):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2022 at 14:15):

alexcrichton created PR review comment:

This may have gone a bit awry

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2022 at 17:02):

fitzgen updated PR #4779 from stack-trace-panic to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2022 at 17:03):

fitzgen created PR review comment:

Whoops...

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2022 at 17:03):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2022 at 17:03):

fitzgen has enabled auto merge for PR #4779.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2022 at 18:28):

fitzgen merged PR #4779.


Last updated: Dec 23 2024 at 12:05 UTC