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
From the wat file and the interpreter logs, there are several incorrect codes like local.set $5, 4294967280, i32.add 4294967280, 28 (overflow), and 32.load $0:4294967280+$28. Why are these illegal instructions generated?
I expected to see this happen: no out of bounds errors.
Instead, this happened: the resulting wasm file tries to access out of bounds memory from the value stack. I have tried with the parity/wasmi interpreter, wasm-interp and wasmtime.
The code is compiled with cargo --build --release and optimized using the following config. I also use the compiler flag "-C", "link-arg=-zstack-size=16".
My bad, I thought link-arg=-zstack-size=16 would mean 16*4KiB because the documentation said The size should be an even multiple of 4KB, that is the last three hexadecimal digits should be zero.. This resulted in stacks of only 16 bytes, which resulted in wasm trying to access negative addresses of the linear memory, which in turn results in OOB errors.
I tried this code:
Here is the wat file:
Backtrace
Here is the output from running
wasm-interp wasm/bicg.wasm --run-all-exports --trace
Backtrace
From the wat file and the interpreter logs, there are several incorrect codes like
local.set $5, 4294967280
,i32.add 4294967280, 28
(overflow), and32.load $0:4294967280+$28
. Why are these illegal instructions generated?I expected to see this happen: no out of bounds errors.
Instead, this happened: the resulting wasm file tries to access out of bounds memory from the value stack. I have tried with the parity/wasmi interpreter, wasm-interp and wasmtime.
The code is compiled with
cargo --build --release
and optimized using the following config. I also use the compiler flag"-C", "link-arg=-zstack-size=16"
.The issue is reproducible with pratically any file in https://github.com/jiayihu/polybench-rs/tree/master/wasm, which are wasm modules containing the Polybench functions.
Meta
rustc --version --verbose
(I have tried also with rustc 1.50.0 nightly, which I was using before updating to latest to test if anything changed):The text was updated successfully, but these errors were encountered: