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

Whether validate exit status for proc_exit is needed #551

Open
luxinyi0105 opened this issue Aug 29, 2023 · 1 comment
Open

Whether validate exit status for proc_exit is needed #551

luxinyi0105 opened this issue Aug 29, 2023 · 1 comment

Comments

@luxinyi0105
Copy link

Recently, while executing the same wasm file with different wasm runtime tools, the obtained results were different. Here are related files.

The given testcase 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 global.set 0 in line 7627 with local.set 0. The result after mutation is mutated_file.wat, and its wasm format is mutated_file.wasm.

We use runtime tools such as wasmer, wasmtime, wasmedge and wasmi to execute mutated_file.wasm. Wasmtime outputs checksum results with runtime error, while other tools only output checksum results. The execution results of different tools are shown in the following figure.
runtime result

It seems that tools such as wasmtime and wasmi validate exit status, while other tools do not. Mutation makes the provided status isn't in the printed range, resulting in runtime error for tools like wasmtime when outputting checksum results.

The current documentation for proc_exit does not exactly specify what to do here. So I wonder whether this behavior is still desired and/or should be codified in the documentation.
If not wasmtime should remove it. If so other runtimes should be updated. Thanks a lot!

@abrown
Copy link
Contributor

abrown commented Aug 29, 2023

Is this related to #524 and WebAssembly/wasi-cli#11?

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

2 participants