LibWasm stack calls clobber caller registers in interpreter mode
Author: CarbocardeCreated Sep 27, 2026Updated Sep 27, 2026
Summary
A stack-based call can overwrite a live caller register in the interpreter mode.
Operating system
macOS
Distro/package (if Linux)
No response
Architecture
AArch64
Commit hash
e50481acd2e00a7b22a8bef1ed7e47a59af7c44a
Steps to reproduce
cmake --preset Release -DENABLE_CRANELIFT_JIT=OFF
cmake --build --preset Release --target wasm
wasm-tools parse repro.wat -o /tmp/repro.wasm
./Build/release/bin/wasm --execute answer /tmp/repro.wasmrepro.wat:
(module
(memory 1)
(func $answer (export "answer") (result i32)
i32.const 0
i32.const 0
i32.const 0
i32.const 0
i32.const 0
call $inner
i32.const 0
i32.const 0
i32.const 0
i32.const 0
call $outer
i32.store
i32.const 0
i32.load)
(func $inner (param i32 i32 i32 i32) (result i32)
i32.const 16
i32.const 1
i32.add)
(func $outer (param i32 i32 i32 i32 i32) (result i32)
local.get 0))Expected behavior
-> 17Actual behavior
-> 4352URL for a reduced test case
N/A
HTML/SVG/etc. source for a reduced test case
(module
(memory 1)
(func $answer (export "answer") (result i32)
i32.const 0
i32.const 0
i32.const 0
i32.const 0
i32.const 0
call $inner
i32.const 0
i32.const 0
i32.const 0
i32.const 0
call $outer
i32.store
i32.const 0
i32.load)
(func $inner (param i32 i32 i32 i32) (result i32)
i32.const 16
i32.const 1
i32.add)
(func $outer (param i32 i32 i32 i32 i32) (result i32)
local.get 0))Log output and (if possible) backtrace
-> 4352Screenshots or screen recordings
No response
Build flags or config settings
ENABLE_CRANELIFT_JIT=OFFThis bug is reachable from a normal build, but this setting makes the testcase much simpler since it'll make it always run in interpreter mode. Otherwise it only repros when the function falls back to the interpreter.
Source: LadybirdBrowser/ladybird