You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
arm64-specific: wasm fails to instantiate: out of bounds memory access #2382
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/[email protected] run ./redis-installer.wasm
# will fail with aforementioned error
go run github.com/tetratelabs/wazero/cmd/[email protected] run ./redis-installer.wasm
changed the title [-]wasm fails to instantiate: out of bounds memory access[/-][+]arm64-specific: wasm fails to instantiate: out of bounds memory access[/+]on Feb 24, 2025
Perhaps still a trampoline issue? I remember when certain programs would hang in version 1.7.x and that a fix was made to the arm64 backend then. Perhaps an off-by-one of sorts is causing a memory out of bounds issue?
@evacchi Just ran against a version with the wasm produced by go1.23.6 and it produces an identical error.
I checked the new wasm did not match the one produced by go1.24.0 as well to be sure.
probably a red herring, I think most of what wasm-opt did in this is case is removing DWARF symbols, and with -env GODEBUG=inittrace=1 it still crashes with OOB
if I elide the bound check it is hard to track what truly is different because many branches obviously disappear (the bound checks themselves), some loads fold UXTW into the addressing mode, and all registers are thus different
Activity
evacchi commentedon Feb 24, 2025
can you run this with amd64 emulation to see if it's specific to arm64? this should do it:
davidmdm commentedon Feb 24, 2025
@evacchi it works under
amd64emulation. So its a bug specific toarm64![-]wasm fails to instantiate: out of bounds memory access[/-][+]arm64-specific: wasm fails to instantiate: out of bounds memory access[/+]davidmdm commentedon Feb 25, 2025
Perhaps still a trampoline issue? I remember when certain programs would hang in version 1.7.x and that a fix was made to the arm64 backend then. Perhaps an off-by-one of sorts is causing a memory out of bounds issue?
evacchi commentedon Feb 25, 2025
@davidmdm out of curiosity, have you tried against Go 1.23? let's rule out something related to #2375
davidmdm commentedon Feb 25, 2025
@evacchi Just ran against a version with the wasm produced by go1.23.6 and it produces an identical error.
I checked the new wasm did not match the one produced by go1.24.0 as well to be sure.
ncruces commentedon Feb 25, 2025
I don't think that's what @evacchi asked for. Don't build the Wasm with 1.23, rather use 1.23 to
go runwazero.davidmdm commentedon Feb 25, 2025
@ncruces Good catch. I got that confused.
@evacchi Same result unfortunately!
evacchi commentedon Feb 26, 2025
interesting, so unrelated issue
evacchi commentedon Feb 27, 2025
FWIW 😅
evacchi commentedon Feb 28, 2025
another "interesting" note, commenting out these lines in the frontend let it run correctly to end:
https://github.com/tetratelabs/wazero/blob/c96893d6910383edcff27ffab5ff4c49f6390462/internal/engine/wazevo/frontend/lower.go#L3668-L3670
evacchi commentedon Mar 1, 2025
🤪
evacchi commentedon Mar 1, 2025
probably a red herring, I think most of what wasm-opt did in this is case is removing DWARF symbols, and with
-env GODEBUG=inittrace=1it still crashes with OOBevacchi commentedon Mar 2, 2025
ok here's what I have learned so far. In function
#2320(big8) register (x11) gets assigned a value that's higher than the given bound:and it "correctly" fails.
this is not even a scaling issue because it would be still
0x28d9000 > 0x2800000the value is loaded waaay earlier in
x10from[x10]and then eventually copied tox11(it goes through a bunch of spills and reloads too):before the load,
x10 = 0x000001402776adf8in post-regalloc, this appears to be block L148:
if I elide the bound check it is hard to track what truly is different because many branches obviously disappear (the bound checks themselves), some loads fold UXTW into the addressing mode, and all registers are thus different
4 remaining items
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug
fix: upgrade wazero to v1.10.1 to fix ARM64 memory access bug