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

Question: how are the WASI API pointer parameters boundary checked and converted to native address #87

Closed
Kevin0626 opened this issue Jul 14, 2019 · 2 comments

Comments

@Kevin0626
Copy link

Hi, according to my understanding about the WASM spec, the two steps in the subject must be executed during the runtime serving a WASI call. I traced it down to https://github.com/CraneStation/wasmtime/blob/master/wasmtime-wasi/src/syscalls.rs and got lost. I have no knowledge about Rust programming yet, so I want to ask for any quick answer. Probably I should plan some time for learning Rust.. thanks..

@kubkon
Copy link
Contributor

kubkon commented Jul 14, 2019

Hey! Yeah, learning some Rust might be a good idea since we're striving to have wasmtime as well as the syscalls lib written purely in Rust. Anyhow, the crate you've arrived at used to be a wrapper around C implementation of the syscalls (now renamed to wasmtime-wasi-c), and now it's a wrapper around a Rust implementation in the form of a wasi-common library.

In terms of decoding pointers and general memory management, the module you are looking for can be found here memory.rs. It might be useful to actually grab a copy of wasmtime, compile it and run some example Wasm with trace logging on:

RUST_LOG=wasi_common=trace wasmtime -d some_binary.wasm

You should get output similar to that found here. Hope that helps! :-)

@Kevin0626
Copy link
Author

Thank you for the guides @kubkon

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