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

Cargo compiled with wasm32-wasi as host #9287

Closed
programmerjake opened this issue Mar 18, 2021 · 3 comments
Closed

Cargo compiled with wasm32-wasi as host #9287

programmerjake opened this issue Mar 18, 2021 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@programmerjake
Copy link
Member

programmerjake commented Mar 18, 2021

Describe the problem you are trying to solve

Have a version of cargo and rustc compiled to wasm32-wasi (or some other wasm arch) such that they can securely/reproducably be run cross-platform/cross-arch even if compiling malicious code.

Describe the solution you'd like

Maybe this can be done by having an alternate host ABI that includes posix_spawn as one of the provided functions? Maybe cargo could be changed to add a configure option to not require pthread_create or equivalent?
Notes

WASI doesn't currently have create_thread or posix_spawn functions iirc...posix_spawn is much easier to implement.
iirc someone got rustc to work with wasm as the host arch, I wasn't able to find it again when I looked later.

@programmerjake programmerjake added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Mar 18, 2021
@programmerjake
Copy link
Member Author

WASI posix_spawn: WebAssembly/WASI#414

@alexcrichton
Copy link
Member

Thanks for the report, but Cargo fundamentally, as you've seen, spawns subprocesses which isn't supported with WASI yet. Furthermore Cargo does a lot of network traffic and pipe managment with subprocesses, so WASI has a bit of aways to go I think before it can support Cargo.

@programmerjake
Copy link
Member Author

What would you consider the minimal additions to WASI to allow cargo to work (perhaps with some modifications to avoid threads)?

My guess:
posix_spawn
pipe
proc_wait (or async equivalent)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants