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

Interface validation when publishing a package compiled with cargo wasix build #4161

Open
Michael-F-Bryan opened this issue Aug 17, 2023 · 3 comments
Labels
priority-medium Medium priority issue
Milestone

Comments

@Michael-F-Bryan
Copy link
Contributor

Michael-F-Bryan commented Aug 17, 2023

Describe the bug

I just tried to publish a package (wasmerio/fork-bomb) that was compiled using cargo wasix build and ran into validation errors. It looks like our code for interfaces doesn't know about WASIX, or at least the wasix_32v1 interface.

$ wasmer --version --verbose
wasmer 4.1.1 (0bd4b48 2023-08-03)
binary: wasmer-cli
commit-hash: 0bd4b48691924127200ea206f72b813e85d11520
commit-date: 2023-08-03
host: aarch64-apple-darwin
compiler: singlepass,cranelift

$ rustc --version --verbose
rustc 1.73.0-nightly (1b198b3a1 2023-08-13)
binary: rustc
commit-hash: 1b198b3a196442e14fb06978166ab46a4618d131
commit-date: 2023-08-13
host: aarch64-apple-darwin
release: 1.73.0-nightly
LLVM version: 17.0.0

$ cargo wasix --version
cargo-wasix 0.1.21

Steps to reproduce

$ git clone https://github.com/wasmerio/fork-bomb
$ cd fork-bomb
$ cargo wasix build --release
$ wasmer publish --registry=wasmer.wtf
error: WASM file "/Users/work/Documents/wasmer/fork-bomb/target/wasm32-wasmer-wasi/release/fork-bomb.wasm" detected as invalid because InterfaceViolated { errors: ["Missing import \"wasix_32v1\" \"sock_open\"", "Missing import \"wasix_32v1\" \"epoll_wait\"", "Missing import \"wasix_32v1\" \"thread_exit\"", "Missing import \"wasi\" \"thread-spawn\"", "Missing import \"wasix_32v1\" \"fd_dup\"", "Missing import \"wasix_32v1\" \"epoll_create\"", "Missing import \"wasix_32v1\" \"callback_signal\"", "Missing import \"wasix_32v1\" \"futex_wake_all\"", "Missing import \"wasix_32v1\" \"futex_wait\"", "Missing import \"wasix_32v1\" \"sock_connect\"", "Missing import \"wasix_32v1\" \"sock_listen\"", "Missing import \"wasix_32v1\" \"sock_accept_v2\"", "Missing import \"wasix_32v1\" \"sock_set_opt_size\"", "Missing import \"wasix_32v1\" \"sock_set_opt_flag\"", "Missing import \"wasix_32v1\" \"resolve\"", "Missing import \"wasix_32v1\" \"getcwd\"", "Missing import \"wasix_32v1\" \"thread_signal\"", "Missing import \"wasix_32v1\" \"fd_event\"", "Missing import \"wasix_32v1\" \"sock_bind\"", "Missing import \"wasix_32v1\" \"epoll_ctl\"", "Missing import \"wasix_32v1\" \"futex_wake\""] }

The error complains about loads of missing imports from the wasix_32v1 namespace.

Additional context

@ptitSeb ptitSeb added the priority-medium Medium priority issue label Aug 22, 2023
@ptitSeb
Copy link
Contributor

ptitSeb commented Aug 22, 2023

Need to be able to handle abi = 'wasix' in wasmer.toml of packages.

@ptitSeb ptitSeb added this to the v4.3 milestone Aug 22, 2023
@liudonghua123
Copy link

liudonghua123 commented Nov 15, 2023

I also encounter the similar issue when run php-8.2.6-wasmedge.wasm with the latest wasmer 4.2.3.

> wasmer php-8.2.6-wasmedge.wasm --dir . hello.php
error: Instantiation failed
╰─▶ 1: Error while importing "wasi_snapshot_preview1"."sock_open": unknown import. Expected Function(FunctionType { params: [I32, I32, I32], results: [I32] })

See also vmware-labs/webassembly-language-runtimes#121.

@theduke
Copy link
Contributor

theduke commented Nov 15, 2023

@liudonghua123 this is a different problem. sock_open is not part of wasi preview1.

Not sure where this is coming from, but it's not official.

@syrusakbary syrusakbary modified the milestones: v4.5, backlog Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

5 participants