Stream: git-wasmtime

Topic: wasmtime / PR #8415 Restrict the preview1 implementation ...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 18:47):

elliottt opened PR #8415 from elliottt:trevor/fix-p1-fd-read-mut-borrows to bytecodealliance:main:

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 runtiem 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>

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 18:47):

elliottt has marked PR #8415 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 18:47):

elliottt requested wasmtime-core-reviewers for a review on PR #8415.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 18:47):

elliottt requested alexcrichton for a review on PR #8415.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 18:47):

elliottt requested wasmtime-core-reviewers for a review on PR #8415.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 18:48):

elliottt edited PR #8415:

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>

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 19:12):

alexcrichton commented on PR #8415:

I was initially confused reading over this trying to piece together how this wasn't covered by https://github.com/bytecodealliance/wasmtime/pull/8353 but that was fd_pread rather than fd_read.

Mind adding a test for this? Also, can you update the filter here to be the same as https://github.com/bytecodealliance/wasmtime/pull/8353 where it searches for the first non-empty buffer rather than the first buffer?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 21:20):

elliottt updated PR #8415.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 21:22):

elliottt commented on PR #8415:

I added a test, and verified that it failed without the fix to fd_read. (It's the same as the pread/pwrite test, but using fd_seek to polyfill their behavior.)

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 21:26):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 21:28):

elliottt updated PR #8415.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 21:29):

elliottt updated PR #8415.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2024 at 22:46):

elliottt merged PR #8415.


Last updated: Nov 22 2024 at 17:03 UTC