Control: reassign -1 rustc 1.68.2+dfsg1-1
Control: retitle -1 Builds invalid wasm32 binaries (1.67->1.68 regression)

On Tue, Sep 12, 2023 at 10:56:57PM +0100, Peter Green wrote:
> The autopkgtests for wasmedge fail with rustc 1.68, I have observed this with
> both testing and unstable's versions of wasmedge, and with both testing and
> unstable's versions of wasi-lib.

Thanks for the report. Actually, I think the WasmEdge autopkgtests are
catching a rustc 1.68 regression, whereas rustc compiles wasm32 binaries
that do not work with neither WasmEdge, nor Wasmtime (the latter is not
in Debian).

Very simple test case:

$ podman run --rm -it debian:sid  # or bookworm to test with rustc 1.67

root@ad697f1c195f:~# apt install rustc libstd-rust-dev-wasm32
[...]
root@ad697f1c195f:~# rustc -V
rustc 1.68.2
root@ad697f1c195f:~# cat > hello.rs <<EOF
fn main() {
    println!("Hello World!");
}
EOF
root@ad697f1c195f:~# rustc --target=wasm32-wasi hello.rs
root@ad697f1c195f:~#

# execute the code with WasmEdge
root@ad697f1c195f:~# apt install wasmedge
[...]
root@ad697f1c195f:~# wasmedge ./hello.wasm
[2023-09-12 22:12:41.190] [error] execution failed: unreachable, Code: 0x89
[2023-09-12 22:12:41.190] [error]     In instruction: unreachable (0x00) , 
Bytecode offset: 0x00009cd6
[2023-09-12 22:12:41.190] [error]     When executing function name: "_start"

# test with Wasmtime
root@ad697f1c195f:~# apt install xz-utils wget
[...]
root@ad697f1c195f:~# wget -qO- 
https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.1/wasmtime-v12.0.1-x86_64-linux.tar.xz
 | tar --wildcards --strip-components=1 -xJ  '*/wasmtime'

root@ad697f1c195f:~# ./wasmtime hello.wasm
Error: failed to run main module `hello.wasm`

Caused by:
    0: failed to invoke command default
    1: error while executing at wasm backtrace:
           0: 0x9cd6 - <unknown>!__stack_chk_fail
           1: 0x9d3c - <unknown>!__wasilibc_init_ssp
           2:  0x320 - <unknown>!__wasm_call_ctors
           3:  0x342 - <unknown>!_start
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may 
show more debugging information
    2: wasm trap: wasm `unreachable` instruction executed


Thanks,
Faidon

Reply via email to