-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Rewrite WASI implemention from C to Rust #120
Comments
I'd be happy to help out with this especially since it intersects with the areas of my interests #121. |
That'd be great! As I mentioned above, |
Awesome! So, I've played somewhat with the code, and to get an idea of how things are stitched together, I've had a stab at implementing To quickly sum them up though, I've removed |
That's a good question. I don't have a specific plan in mind for how to handle that yet. I'll think about it, though if you have ideas about how best to do that, I'd be interested in hearing them too. |
Ok, here's a concrete idea. What if we leave the shim logic and the rest of syscalls.rs as is, and just replace the |
SGTM! I'll draft it out and submit a PR, and I guess we can take it from there. |
Multiple people are interested in this, which is great! To help avoid duplicating work, here are a few rough groups of functions that people can start with, with the more complex ones toward the end.
If you want to start one of these groups, please check here and then post about it, and we'll figure out the details as we go. As always, feel free to ask questions! |
Some of these already have implementations over in As a separate note, we could probably figure out a way for Lucet runtime and wasmtime to present the same API to this sort of function, so that the same crate could be used in both runtimes. |
@pchickey I don't mind lifting the implementation from lucet-wasi. What is your preference @sunfishcode? I also really like the idea of sharing the implementations between the runtimes! If it's OK with everyone, I'd like to have a go at the EDIT: and while I'm at it, I can also have a look at |
As an update here, I talked with @pchickey and others and they suggested a way we can proceed here, which is to add a cargo git dependency on lucet-wasi (it's not on crates.io yet, but a git dependency is fine for now). I think it makes sense to finish up the @kubkon Would you be willing to create a branch with such a depedency, so we can start exploring it? |
@sunfishcode Sure thing, I'll be happy to do that! |
So, I've had a closer look at lucet-wasi and I've done some preliminary work at extracting the functionality which I thought could be reused between the Lucet and Wastime projects. You can find the extracted bits in the repo wasi-common. I've also made sure that it will work fine with both Wasmtime and Lucet runtimes which you can access in my local forks: wasmtime#lucet-wasi and lucet#lucet-wasi. I should warn you though that in order to make that happen I've had to resort to some pretty messy hacks, so please do bear that in mind. If we'll decide to continue down that road, however, I'm sure we'll be able to clean it all up. Anyhow, here's a brief summary of the changes to
All in all, as you can see in wasmtime#lucet-wasi, the Finally, I've tested both runtimes with the introduced changes and they work and test out fine. As I said before, however, the code is rather messy and will need to be cleaned up should we decide to continue going down that road. Anyhow, @sunfishcode and @pchickey I'm curious to hear out your opinions! |
I'm going to hand this off to @acfoltzer and @jedisct1 - they wrote lucet-wasi, and Adam designed the |
For those of you tracking the issue, you can find our efforts for this in CraneStation/wasi-common repo. |
Since it’s well and ongoing in CraneStation/wasi-common, I’m going to close this issue as it’s no longer directly applicable to |
…time Update to Wasmtime 7
This PR adds tests for the backtrace support added in earlier PRs in this series
Generate `AluRRRShift` spec with ASLp. This is the second example of a spec that relies on symbolic opcodes, but it's slightly more challenging because the shift amount determines the size of the symbolic field. Not only that, but the spec cases split on `shiftop`, which is a struct type. In addition, the `lshl_from_imm64` spec needed to be fixed. Updates avanhatt#36 avanhatt#35 Closes bytecodealliance#120
Wasmtime's current WASI implementation is derived from what CloudABI calls its userspace emulator code. This was an expedient way to get to a relatively complete WASI implementation that we could use to do early API iteration and to prototype the rest of the ecosystem on, however it also serves as a reference implementation of sorts, as WASI and CloudABI are relatively thin on API-level documentation.
However, an implementation in Rust would be preferable, because it would be easier to maintain along with the rest of Wasmtime's Rust code, it would be safer (there will likely still be
unsafe
code, however that's still an improvement over all the code being effectively "unsafe"), and it'd allow us to reduce our dependencies on cmake and cc. It may even make sense to build WASI as a crate that can be independent of Wasmtime entirely, so that it can be used in other contexts.And, since CloudABI considers this "emulation" code, it isn't as robust as we'd ideally like it to be. For example,
poll_oneoff
only supports one clock subscription, some obscure features aren't implemented yet, and there may be other limitations.This is a big project, though we can implement it one step at a time, starting with simple functions and building up to more complex ones. The very first function to do is probably
proc_exit
, and possibly next theargs_get
/args_sizes_get
/environ_get
/environ_sizes_get
functions.I'll probably start work on this as I have time, though if anyone else wants to take a look at these, I'd be happy to mentor!
The text was updated successfully, but these errors were encountered: