Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe incorrect behavior while meeting misaligned pointer #772

Open
luxinyi0105 opened this issue Sep 26, 2023 · 0 comments
Open

Maybe incorrect behavior while meeting misaligned pointer #772

luxinyi0105 opened this issue Sep 26, 2023 · 0 comments

Comments

@luxinyi0105
Copy link

Describe the bug

While executing the given testcase with wasmi and other runtime tools, the results are different.

Test Case

The given testcase was simply mutated a wasm file, which was obtained by compiling C program generated with Csmith using Emscripten Compiler(Emcc).

The original C program is c_file.c, the compilation results with Emscripten is wasm_file.wasm, and its wat format is wat_file.wat.

We mutated the wat file to change its i32.sub in line 12189 with i32.div_s, and change all the i32/i64.ge_u with i32/i64.le_s. The result after mutation is mutated_file.wat, and its wasm format is mutated_file.wasm.

Actual Results

$ ~/Software_new/wasmi/target/release/wasmi_cli mutated_file.wasm
executing File("mutated_file.wasm")::_start() ...
checksum = 

Expected Results

I use some other runtime tools, such as wasmer, wasmtime, wasmedge and wasm-micro-runtime, to execute the same testcase. Wasmer and wasmtime outputs checksum = with runtime error caused by misaligned pointer, while wasmedge and wasm-micro-runtime outputs checksum = AF3BD5C3. The execution results of different runtime tools are shown in the following figure.

截图 2023-09-26 14-25-57

From the execution results, five different runtime tools obtained three different results while executing the same testcase. As I mentioned in issue #771, when wasmi encountered similar testcases before, it either output nothing or also output runtime errors caused by misaligned pointers. So I am not sure whether the behavior here is correct. Maybe this issue is the same as issue #771, and the detail still needs you to confirm. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant