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

WASI fd_write and fd_read fails on memory boundary #1258

Closed
subzey opened this issue Mar 2, 2020 · 1 comment · Fixed by #1272
Closed

WASI fd_write and fd_read fails on memory boundary #1258

subzey opened this issue Mar 2, 2020 · 1 comment · Fixed by #1272
Labels
bug Something isn't working

Comments

@subzey
Copy link

subzey commented Mar 2, 2020

Describe the bug

WASI fd_write and fd_read fails if the iovec describes a buffer such that its right boundary coincides with the memory right boundary.

Example:

There's 1 page of memory (0x10000 bytes).

Callng fd_read or fd_write with iovec[ 65532, 4 ]:

    FFFC FFFD FFFE FFFF
───┬────┬────┬────┬────╖
...│    │    │    │    ║
───┴────┴────┴────┴────╜
   │←───── len: 4 ────→│
   ↑ offset: 0xFFFC (65532)

The wasm memory size is just enough to fit this buffer. But the call errs with code 21.

If len is changed to 3, it works nicely.

If memory size is changed to 2 (2 * 0x10000 bytes), it works nicely.

wasmer version 0.14.1
OS x86_64 GNU/Linux (Ubuntu 18.04)
Rust compiler is not used.

Steps to reproduce

Run this .wat file with wasmer run

https://gist.github.com/subzey/7dd2cc27274b59322d78878f73a0944d

Expected behavior

It should output TEST into stdout and exit with 0 exit code.

Actual behavior

It outputs nothing and exists with 21.

Additional context

This file executed with wasmtime works as expected.

@subzey subzey added the bug Something isn't working label Mar 2, 2020
@syrusakbary
Copy link
Member

Thanks for reporting and for the minimal reproduce case, it's super helpful!

We will investigate soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants