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

The result is different from other wasm runtimes while executing the given wasm file with wasmer #4142

Open
luxinyi0105 opened this issue Aug 10, 2023 · 4 comments
Labels
bug Something isn't working 📦 lib-compiler About wasmer-compiler 📦 lib-wasi About wasmer-wasi lib-wasix Issues related to the WASIX toolchain. 🕵️ needs investigation The issue/PR needs further investigation priority-medium Medium priority issue
Milestone

Comments

@luxinyi0105
Copy link

luxinyi0105 commented Aug 10, 2023

Describe the bug

While executing the given wasm files with wasmer and some other wasm runtimes, such as wasmtime and wasmedge, the results are different.

$ wasmer -vV
wasmer 4.0.0 (6ccf29d 2023-07-24)
binary: wasmer-cli
commit-hash: 6ccf29df1ebab40b3e3e7676ceac7f9deab9a8a3
commit-date: 2023-07-24
host: x86_64-unknown-linux-gnu
compiler: singlepass,cranelift,llvm
$ rustc -vV
rustc 1.73.0-nightly (0308df23e 2023-07-21)
binary: rustc
commit-hash: 0308df23e621e783e31a27ca5beaa01b9df60d4a
commit-date: 2023-07-21
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Expected behavior

$ wasmer wasm_file_1.wasm

We believe that the "expected behaviour" should be to not output anything.

The reason is that using other wasm runtime tools, such as wasmtime and wasmedge, to execute the same test case results in nothing being output.

Actual behavior

$ wasmer wasm_file_1.wasm
checksum = 0����\�����ih�ih�ih�ih�ih�ih�ih^N�����B�*��D+�\�������^N��������     '�=7���7������� �����v� 7����v�7���v�7���7���'�=        ��������v��v�����������������vP�P��=�~I���P������������wasm_file_1.wasm��-+   0X0x-0X+0X 0X-0x+0x 0xnaninfg_1056[i][j]g_888[i]g_1243[i]NANINFg_1199g_789g_279g_69g_19g_419g_1109g0

Additional context

wasm_file_2.wasm in zip has similar problem, the distinction is that executing it with wasmer only outputs checksum = without any additional garbled code.

@Michael-F-Bryan Michael-F-Bryan added bug Something isn't working 🕵️ needs investigation The issue/PR needs further investigation labels Aug 15, 2023
@Michael-F-Bryan
Copy link
Contributor

@luxinyi0105 do you have the source code that this program was compiled from? That'll make investigating a lot easier because we can pinpoint which parts of the program introduce the issue.

@Michael-F-Bryan Michael-F-Bryan added 📦 lib-wasi About wasmer-wasi 📦 lib-compiler About wasmer-compiler priority-medium Medium priority issue lib-wasix Issues related to the WASIX toolchain. labels Aug 15, 2023
@Michael-F-Bryan Michael-F-Bryan added this to the v4.2 milestone Aug 15, 2023
@luxinyi0105
Copy link
Author

@luxinyi0105 do you have the source code that this program was compiled from? That'll make investigating a lot easier because we can pinpoint which parts of the program introduce the issue.

Thanks for your reply.

For testcase_1, the original C program is c_file_1.c, the compilation results with Emscripten is wasm_file_1.wasm, and its wat format is wat_file_1.wat.

We mutated the wat file to change all lt_s with le_u, and change all lt_u with gt_u. The result after mutation is mutated_file_1.wat, and its wasm format is mutated_file_1.wasm.

$ wasmer wasm_file_1.wasm
checksum = 26F04D2E

$ wasmer mutated_file_1.wasm
checksum = 0����\�����ih�ih�ih�ih�ih�ih�ih^N�����B�*��D+�\�������^N��������     '�=7���7������� �����v� 7����v�7���v�7���7���'�=        ��������v��v�����������������vP�P��=�~I���P������������wasm_file_1.wasm��-+   0X0x-0X+0X 0X-0x+0x 0xnaninfg_1056[i][j]g_888[i]g_1243[i]NANINFg_1199g_789g_279g_69g_19g_419g_1109g0

For testcase_2, the original C program is c_file_2.c, the compilation results with Emscripten is wasm_file_2.wasm, and its wat format is wat_file_2.wat.

We mutated the wat file to change all lt_u with gt_s, and change all le_s with gt_s. The result after mutation is mutated_file_2.wat, and its wasm format is mutated_file_2.wasm.

$ wasmer wasm_file_2.wasm
checksum = 47062B32

$ wasmer mutated_file_2.wasm
checksum = 

Copy link

stale bot commented Aug 18, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the 🏚 stale Inactive issues or PR label Aug 18, 2024
Copy link

stale bot commented Sep 20, 2024

Feel free to reopen the issue if it has been closed by mistake.

@stale stale bot closed this as completed Sep 20, 2024
@syrusakbary syrusakbary reopened this Sep 20, 2024
@stale stale bot removed the 🏚 stale Inactive issues or PR label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📦 lib-compiler About wasmer-compiler 📦 lib-wasi About wasmer-wasi lib-wasix Issues related to the WASIX toolchain. 🕵️ needs investigation The issue/PR needs further investigation priority-medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants