wazero: arm64-specific: wasm fails to instantiate: out of bounds memory access
Describe the bug Running a wasm binary returns the error:
error instantiating wasm binary: module[] function[_start] failed: wasm error: out of bounds memory access
wasm stack trace:
.time.__dataIO_.big8(i32) i32
.github.com_BurntSushi_toml_internal.init(i32) i32
.runtime.doInit1(i32) i32
.runtime.main(i32) i32
.wasm_pc_f_loop()
._rt0_wasm_wasip1()
To Reproduce Running on Darwin/arm64 M2 chip
set -x
if [ ! -d "yoke" ]; then
git clone --depth=1 https://github.com/yokecd/yoke.git
fi
(
cd yoke
GOOS=wasip1 GOARCH=wasm go build -o ../redis-installer.wasm ./examples/redis
)
# will run successfully
go run github.com/tetratelabs/wazero/cmd/wazero@v1.6.0 run ./redis-installer.wasm
# will fail with aforementioned error
go run github.com/tetratelabs/wazero/cmd/wazero@v1.9.0 run ./redis-installer.wasm
Expected behavior Expected same output as wazero@v1.6.0
Environment (please complete the relevant information):
- Go version: 1.24.0
- wazero Version: 1.9.0
- Host architecture: arm64
- Runtime mode: compiler
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (17 by maintainers)
ok, some degree of progress,
big8can’t be that big, and in fact with a little help from our friend GOSSAFUNCwe see there is a bunch of inlining happening. I tried a flag to disable inlining earlier and I didn’t get any success… but it turns out the flag has changed and the one I supplied was just being ignored 😄
so here’s the right incantation:
surprise:
and with
GODEBUG='inittrace=1':this is great news because I think the root cause of the issue is the same (same weird difference in crashing behavior when
inittrace=1), but at the same time the crash with no inittrace is a nil value which might be slightly easier to pinpoint!I don’t have the technical expertise to add anything, but I just wanted to let you know that I appreciate your updates!