luxinyi0105 added the bug label to Issue #7235.
luxinyi0105 opened issue #7235:
Describe the bug
While executing the given testcase with wasmtime and other runtime tools, the result are different.
Test Case
The given testcase was simply mutated a wasm file, which was obtained by compiling C program generated with
Csmith
usingEmscripten Compiler
(Emcc).The original C program is
c_file.c
, the compilation results with Emscripten iswasm_file.wasm
, and its wat format iswat_file.wat
.We mutated the wat file to:
-- change all itsi32/i64/f64.sub
withi32/i64/f64.add
;
-- change all itsi32/i64.and
withi32/i64.xor
;
-- change all itsi32/i64.lt_s
withi32/i64.ge_u
;
-- change all itsi32/i64.mul
withi32/i64.div_u/div_s
;
The result after mutation ismutated_file.wat
, and its wasm format ismutated_file.wasm
.Actual Results
$ ~/Wasm_Runtime_Tools/wasmtime_13.0.0/target/debug/wasmtime mutated_file.wasm Error: failed to run main module `mutated_file.wasm` Caused by: 0: failed to invoke command default 1: error while executing at wasm backtrace: 0: 0xb52e - <unknown>!<wasm function 67> 1: 0xb4b8 - <unknown>!<wasm function 66> 2: Pointer not aligned to 4: Region { start: 65527, len: 4 }
Expected Results
I tried to use other runtime tools, such as wasmer, wasmedge, and wamr to run the same testcase, their running results are as follows:
![截图 2023-10-13 16-26-52](https://github.com/bytecodealliance/wasmtime/assets/92167273/cbbc6296-f4ec-427b-b2b0-eec4d89438ea)
From the picture, we can see that tools like wasmer and wasmedge will output runtime error due to
integer divide by zero
. I wonder whether wasmtime should also output the same runtime error, and when there are multiple errors in the testcase, what the priority of runtime error output in the terminal is.Versions and Environment
Wasmtime version or commit: wasmtime-cli 13.0.0
Operating system: Ubuntu 22.04.1
Architecture: x86_64
bjorn3 commented on issue #7235:
Wasmtime outputs "Pointer not aligned to 4". According to wasi pointers need to be aligned and wasmtime checks for this. Several other wasi implementations don't check for it however and thus hits the "integer divide by zero" at a later point.
pchickey commented on issue #7235:
This is the exact same behavior we closed as not a bug in https://github.com/bytecodealliance/wasmtime/issues/7081. This issue is also filed using the exact same language. Because these issues take more of our time to triage than they take for you to file, please try to filter out these duplicates on your end so that we can spend our attention on valid issues.
pchickey closed issue #7235:
Describe the bug
While executing the given testcase with wasmtime and other runtime tools, the result are different.
Test Case
The given testcase was simply mutated a wasm file, which was obtained by compiling C program generated with
Csmith
usingEmscripten Compiler
(Emcc).The original C program is
c_file.c
, the compilation results with Emscripten iswasm_file.wasm
, and its wat format iswat_file.wat
.We mutated the wat file to:
-- change all itsi32/i64/f64.sub
withi32/i64/f64.add
;
-- change all itsi32/i64.and
withi32/i64.xor
;
-- change all itsi32/i64.lt_s
withi32/i64.ge_u
;
-- change all itsi32/i64.mul
withi32/i64.div_u/div_s
;
The result after mutation ismutated_file.wat
, and its wasm format ismutated_file.wasm
.Actual Results
$ ~/Wasm_Runtime_Tools/wasmtime_13.0.0/target/debug/wasmtime mutated_file.wasm Error: failed to run main module `mutated_file.wasm` Caused by: 0: failed to invoke command default 1: error while executing at wasm backtrace: 0: 0xb52e - <unknown>!<wasm function 67> 1: 0xb4b8 - <unknown>!<wasm function 66> 2: Pointer not aligned to 4: Region { start: 65527, len: 4 }
Expected Results
I tried to use other runtime tools, such as wasmer, wasmedge, and wamr to run the same testcase, their running results are as follows:
![截图 2023-10-13 16-26-52](https://github.com/bytecodealliance/wasmtime/assets/92167273/cbbc6296-f4ec-427b-b2b0-eec4d89438ea)
From the picture, we can see that tools like wasmer and wasmedge will output runtime error due to
integer divide by zero
. I wonder whether wasmtime should also output the same runtime error, and when there are multiple errors in the testcase, what the priority of runtime error output in the terminal is.Versions and Environment
Wasmtime version or commit: wasmtime-cli 13.0.0
Operating system: Ubuntu 22.04.1
Architecture: x86_64
Last updated: Dec 23 2024 at 13:07 UTC