-
Notifications
You must be signed in to change notification settings - Fork 824
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
Rust program can not open a file #356
Comments
I think I met the same error here. when I use https://github.com/kubkon/rust-wasi-tutorial for test wasi but run the wasm as follow, I get some unexpected result: $ wasmer run ./target/wasm32-unknown-wasi/debug/main.wasm in.txt out.txt
"RuntimeError: Instance exited" |
It seems like, in the rust-wasi-tutorial, they use It does seem like it is easy to preopen a directory, though. EDIT: this issue is marked as "bug" but it is not really a bug, but more a request feature. EDIT2: it is harder to implement this feature than I though. |
Hi! Thanks for the bug report, I've started adding support for pre-opened file descriptors in #343 ! So you're right, it's both easy and a bit tricky. The idea in #343 was to get a first-pass, unsandboxed working solution up and running and go from there. Currently I'm running in to some extremely strange bugs when running the libsodium tests (some of them seem to fail for no reason during setup and adding irrelevant modifications to the source code of libsodium makes the tests pass -- so it's a really nasty bug. That said, we'll use this as an opportunity to keep improving the debugging story with Wasmer and get it all working soon), so we haven't shipped it yet. I'd like to get this fixed up soon, but unfortunately I won't be able to focus on this immediately. I'll post updates as I learn/do more in regards to pre-opened FDs! |
Thank you for working on this issue and for the future updates you will put here! |
What are the failing tests? How did you compile libsodium? What are you getting in the relevant |
Hi! Thanks for coming by! I'm currently under the impression that it's likely to be a subtle bug somewhere in our WASI fs code and that I missed something while debugging. You bring up a good point though, I didn't verify my set up with wasmtime or any other runtime yet, which seems like a good starting point. I'm using clang with WASI support that I set up a while ago and using the normal libsodium test harness but modified to run wasmer instead of wasmtime. 24/69 of the minimal tests were passing the last time I ran it, When I get some time to work on this again, I'll be able to write up what I've seen in more detail with better logs. (I think these logs may have been generated with a version more up to date than what I've pushed to GitHub so far) |
Unfortunately, I'm not familiar enough with your WASI code to make sense of these debugging logs. But all tests perform the same thing: they write a They don't access any other files as far as I can remember. |
btw, would it be possible to change this issue label to be "features" instead of "bug" :) |
Thanks @jedisct1 ! That's good to know, I tested it and verified that it works with wasmtime. Hello, everyone! This is a section of the log from
Now here's box_easy, note the
If we shift
which looks like exactly what we want... by checking it in the wasi syscall after we write to it, we can see:
That the way we're setting memory just isn't working here 🙀 Now, I'm not sure why this is, we're constructing a Feel free to contribute and/or wildly speculate if you all have any ideas about this 🤔 edit: |
Okay, 74/77 of the libsodium tests are passing (all the pre-opened fd stuff works); I'll be shipping the current implementation tomorrow (it'll take some time to clean up) which has some major limitations, but will work for basic cases and I'll follow up shortly after (hopefully tomorrow) and make it much more robust! edit: the remaining failures seem to be in regard to wasmer's return values. We'll investigate and figure that out a bit later |
343: add preopened fd and fix/improve fs syscalls; fix wasi memory access r=MarkMcCaskey a=MarkMcCaskey resolves #356 Co-authored-by: Mark McCaskey <[email protected]>
343: add preopened fd and fix/improve fs syscalls; fix wasi memory access r=MarkMcCaskey a=MarkMcCaskey resolves #356 Co-authored-by: Mark McCaskey <[email protected]> Co-authored-by: Syrus Akbary <[email protected]> Co-authored-by: Mark McCaskey <[email protected]>
Thank you @MarkMcCaskey for your great work :) |
…s--main--components--wasmer-sdk chore(main): release wasmer-sdk 0.5.0
Hello,
It is probably highly related to #297 currently but I prefer posting this issue to track the progression of the "fix".
I am currently testing wasmer, it is an awesome project, it work great with Rust, especially when compiling for the
wasm32-unknown-wasi
target.However I tried a little program just to display the content of a file and hit a little problem: It is not possible to open a file. Here is the minimum program to reproduce that:
The error returned is thrown by the Rust std library:
Thank you for helping :)
The text was updated successfully, but these errors were encountered: