Stream: git-wasmtime

Topic: wasmtime / PR #9417 [26.0.0] Fix backtraces through empty...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2024 at 15:12):

alexcrichton requested elliottt for a review on PR #9417.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2024 at 15:12):

alexcrichton requested wasmtime-core-reviewers for a review on PR #9417.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2024 at 15:12):

alexcrichton opened PR #9417 from alexcrichton:fix26pr to bytecodealliance:release-26.0.0:

This fixes a bug where we would not properly handle contiguous sequences of Wasm frames that are empty. This was mistakenly believed to be an impossible scenario, and before the tail-calls proposal it was impossible, however it can now happen after the following series of events:

Now we have a stack like [host, entry trampoline, exit trampoline], which has zero Wasm frames between the entry and exit trampolines. If the host function that the exit trampoline calls out to attempts to capture a backtrace, then -- before this commit -- we would fail an internal assertion and panic. That panic would then unwind to the first Rust frame that is called by Wasm. With Rust 1.81 and later, Rust automatically inserts a panic handler that prevents the unwind from continuing into external/foreign code, which is undefined behavior, and aborts the process. Rust versions before 1.81 would attempt to continue unwinding, hitting undefined behavior.

This commit fixes the backtrace capturing machinery to handle empty sequences of Wasm frames, passes the assertion, and avoids unwinding into external/foreign code.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2024 at 15:20):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2024 at 15:24):

alexcrichton has enabled auto merge for PR #9417.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2024 at 15:57):

alexcrichton updated PR #9417.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2024 at 16:12):

alexcrichton merged PR #9417.


Last updated: Dec 23 2024 at 12:05 UTC