-
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
Restrict the preview1 implementation of fd_read to one iovec #8415
Restrict the preview1 implementation of fd_read to one iovec #8415
Conversation
I was initially confused reading over this trying to piece together how this wasn't covered by #8353 but that was Mind adding a test for this? Also, can you update the filter here to be the same as #8353 where it searches for the first non-empty buffer rather than the first buffer? |
…8277 Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
60df49b
to
903aff1
Compare
I added a test, and verified that it failed without the fix to |
903aff1
to
27e1a96
Compare
27e1a96
to
d25e9b2
Compare
…ealliance#8415) * We can only have one mutable borrow at a time after bytecodealliance#8277 Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com> * Add a test like pread/pwrite, but for read/write --------- Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
In the wasi-common implementation of
fd_read
for preview1, switch to only reading the first iovec given in a vectored read. This avoids issues with Wiggle's runtime borrow-checker implemented in #8277, which would cause the reads to unconditionally fail when two mutable borrows were taken out on the same memory.While it's not as efficient to perform a single read at a time, it is also valid, as read never promises to read all of the vectors provided.
Co-authored-by: Nick Fitzgerald fitzgen@gmail.com