-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[22.0.x] Fix backtraces through empty sequences of Wasm frames (#9413)
* Fix backtraces through empty sequences of Wasm frames 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: * Host calls into Wasm, pushing the entry trampoline frame. * Entry trampoline calls the actual Wasm function, pushing a Wasm frame. * Wasm function tail calls to an imported host function, *replacing* the Wasm frame with the exit trampoline's frame. 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. Co-Authored-By: Alex Crichton <[email protected]> * Add release notes * Add more release notes --------- Co-authored-by: Nick Fitzgerald <[email protected]>
- Loading branch information
1 parent
0efa267
commit 21c41f9
Showing
4 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters