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

[17.0.0] Backport fix fd_read and fd_write for wasm32-wasi-threads (#7750) #7755

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

dicej
Copy link
Contributor

@dicej dicej commented Jan 5, 2024

Previously, first_non_empty_{c}io_vec always returned Ok(None) for buffers residing in shared memories since they cannot, in general, safely be represented as slices. That caused e.g. wasi-libc to spin forever when trying to write to stdout using fd_write since it always got Ok(0) and never made progress.

This commit changes the return type of both functions to use GuestPtr instead of GuestSlice{Mut}, allowing safe access to shared guest memory.

Big thanks to Alex Crichton for narrowing this down and suggesting the fix.

…ds` (bytecodealliance#7750)

Previously, `first_non_empty_{c}io_vec` always returned `Ok(None)` for buffers
residing in shared memories since they cannot, in general, safely be represented
as slices.  That caused e.g. `wasi-libc` to spin forever when trying to write to
stdout using `fd_write` since it always got `Ok(0)` and never made progress.

This commit changes the return type of both functions to use `GuestPtr` instead
of `GuestSlice{Mut}`, allowing safe access to shared guest memory.

Big thanks to Alex Crichton for narrowing this down and suggesting the fix.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej requested a review from a team as a code owner January 5, 2024 17:19
@dicej dicej requested review from pchickey and removed request for a team January 5, 2024 17:19
@dicej dicej merged commit 2c9160a into bytecodealliance:release-17.0.0 Jan 5, 2024
40 checks passed
@dicej dicej deleted the backport-7750 branch January 5, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants