Stream: git-wasmtime

Topic: wasmtime / PR #14687 Backtraces: handle stack-walking on ...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 21:38):

cfallin opened PR #14687 from cfallin:fix-stack-overflow-backtrace to bytecodealliance:main:

In #14597, it was noted that on both Pulley and s390x ISAs, Wasmtime does not correctly handle the youngest frame where a stack overflow is detected.

The basic difference between these two platforms and others is that on s390x and Pulley, the frame of the current function is not yet set up when the explicit stack overflow check is done; on other platforms, it is, because there is a small amount of slack in the limit.

So on most platforms (x64, aarch64, riscv64), we can treat the stack-overflow trap like any other, and resolve the PC and FP at the trap site as indicative of function state in the bottommost frame.

But on these platforms, we get a PC in the callee, and an FP still in the caller. We need to resolve this inconsistency by pulling either one or the other "up" or "down" a frame so they are consistent.

I initially tried adding special "frameless PC" support so that we could report the actual youngest frame, without supporting any accesses that would use its FP (since it doesn't have a frame yet). This turns out to break a lot of assumptions, e.g. the ability to get the vmctx from a debug state slot and report what instance the youngest frame belongs to. In essence, it would then propagate complexity upward where callers would have to skip that special/partial frame anyway.

So instead I think it is more coherent to act as if the youngest frame never happened: think of the stack-overflow as happening at the callsite rather than in the callee after the call succeeds. We will thus show a stack-overflow exception at the call instruction that calls a function with a big frame (or any-sized frame that happens to push past the limit and overflow).

This does create its own kind of cross-ISA inconsistency, but IMHO that is more palatable, because the size of frames, and the ABI that implements their storage, is already an ABI- and platform-specific detail anyway. Basically we are saying that for our ABI on s390x and Pulley, because the stack limit has no slack, stack checks logically happen at the call rather than in the callee.

This does still pass the test in #14597: no frame is "skipped", we may just hit overflow at a different arbitrary point on different platforms.

Fixes #14597.

<!--
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 review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.md

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 12 2026 at 21:38):

cfallin requested pchickey for a review on PR #14687.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 21:38):

cfallin requested wasmtime-core-reviewers for a review on PR #14687.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 13 2026 at 01:23):

github-actions[bot] added the label wasmtime:api on PR #14687.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 13 2026 at 22:29):

:thumbs_up: theotherjimmy submitted PR review:

Looks good.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 13 2026 at 23:16):

:thumbs_up: pchickey submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 13 2026 at 23:33):

cfallin updated PR #14687.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 13 2026 at 23:33):

cfallin has enabled auto merge for PR #14687.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 13 2026 at 23:44):

cfallin added PR #14687 Backtraces: handle stack-walking on stack overflow properly on s390x/Pulley, accounting for youngest frame. to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 00:07):

:check: cfallin merged PR #14687.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 00:07):

cfallin removed PR #14687 Backtraces: handle stack-walking on stack overflow properly on s390x/Pulley, accounting for youngest frame. from the merge queue


Last updated: Oct 31 2026 at 23:03 UTC