Stream: git-wasmtime

Topic: wasmtime / PR #5471 wiggle: copy guest slices back to sha...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2022 at 19:47):

abrown opened PR #5471 from wiggle-copied-reads to main:

This change upgrades UnsafeGuestSlice in Wiggle to expose more functionality to be able to use std::ptr::copy for writing bytes into Wasm shared memory. Additionally, it adds a new GuestCow type for delineating between Wasm memory regions that can be borrowed (non-shared memory) or must be copied (shared memory) in order to maintain Rust guarantees.

With these in place, it is now possible to implement the preview1 "read" functions for shared memory. Previously, these would panic if attempting to copy to a shared memory. This change removes the panic and introduces some (rather complex) logic for handling both the shared and non-shared cases:

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2022 at 22:03):

abrown has marked PR #5471 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2022 at 22:32):

abrown requested alexcrichton for a review on PR #5471.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 19 2022 at 23:36):

abrown updated PR #5471 from wiggle-copied-reads to main.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2022 at 20:00):

abrown updated PR #5471 from wiggle-copied-reads to main.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 20 2022 at 20:01):

abrown edited PR #5471 from wiggle-copied-reads to main:

This change upgrades UnsafeGuestSlice in Wiggle to expose more
functionality to be able to use std::ptr::copy for writing bytes into
Wasm shared memory. Additionally, it adds a new GuestCow type for
delineating between Wasm memory regions that can be borrowed (non-shared
memory) or must be copied (shared memory) in order to maintain Rust
guarantees.

With these in place, it is now possible to implement the preview1
"read" functions for shared memory. Previously, these would panic if
attempting to copy to a shared memory. This change removes the panic and
introduces some (rather complex) logic for handling both the shared and
non-shared cases:

This change only applies to the preview0 and preview1
implementations of wasi-common. Fixing up other WASI implementations
(esp. wasi-crypto) is left for later.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 16:09):

alexcrichton created PR review comment:

Since random_get fills the entire buffer I think this will need to loop or otherwise this will return an error since tmp may be shorter than buf

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 16:09):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 16:09):

alexcrichton created PR review comment:

Could you leave some comments that this is for the UnsafeCell inside?

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 16:09):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 16:09):

alexcrichton created PR review comment:

This vec! I think can get removed (just use a [..] on the stack)

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 18:33):

abrown updated PR #5471 from wiggle-copied-reads to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 18:33):

abrown submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 18:33):

abrown created PR review comment:

You might want to take a look at 652988f since I changed the GuestPtr API slightly.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 18:40):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 18:51):

abrown has enabled auto merge for PR #5471.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 19:51):

abrown merged PR #5471.


Last updated: Oct 23 2024 at 20:03 UTC