Stream: git-wasmtime

Topic: wasmtime / PR #6463 fix Wasi rights system to work with w...


view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 00:22):

pchickey opened PR #6463 from bytecodealliance:pch/wasi_read_write_rights to bytecodealliance:main:

Based on #6390

This is an upstreaming of #6462

https://github.com/bytecodealliance/wasmtime/pull/6265 introduced a regression with programs using wasi-libc, reported at https://github.com/WebAssembly/wasi-libc/issues/415.

Wasi-libc read the rights of the base directory (using fd_fdstat_get) and used those to mask the rights requested to path_open. In 6265, I changed the behavior of fdstat_get to always report and empty set of rights. This means that Wasi-libc will always pass an empty set of rights to path_open, which is a problem because the FD_READ and FD_WRITE rights are how path_open determines if a descriptor is to be opened for reading, writing, or both.

The fix is as follows:

Preview 2's wit definition was unintentionally (per @sunfishcode) missing a way for filesystem.{read,write,append}-via-stream to return an error-code when a descriptor cannot be used to create such a stream. I added this to the wit definition in order to make the preview 2 behavior match the legacy implementation.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 00:22):

pchickey edited PR #6463:

Based on #6390

This is an upstreaming of #6462

https://github.com/bytecodealliance/wasmtime/pull/6265 introduced a regression with programs using wasi-libc, reported at https://github.com/WebAssembly/wasi-libc/issues/415.

Wasi-libc read the rights of the base directory (using fd_fdstat_get) and used those to mask the rights requested to path_open. In 6265, I changed the behavior of fdstat_get to always report and empty set of rights. This means that Wasi-libc will always pass an empty set of rights to path_open, which is a problem because the FD_READ and FD_WRITE rights are how path_open determines if a descriptor is to be opened for reading, writing, or both.

The fix is as follows:

Preview 2's wit definition was unintentionally (per @sunfishcode) missing a way for filesystem.{read,write,append}-via-stream to return an error-code when a descriptor cannot be used to create such a stream. I added this to the wit definition in order to make the preview 2 behavior match the legacy implementation.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 00:25):

pchickey edited PR #6463:

Based on #6390 because I needed to edit wits - will land after that merges.

This is an upstreaming of #6462

https://github.com/bytecodealliance/wasmtime/pull/6265 introduced a regression with programs using wasi-libc, reported at https://github.com/WebAssembly/wasi-libc/issues/415.

Wasi-libc read the rights of the base directory (using fd_fdstat_get) and used those to mask the rights requested to path_open. In 6265, I changed the behavior of fdstat_get to always report and empty set of rights. This means that Wasi-libc will always pass an empty set of rights to path_open, which is a problem because the FD_READ and FD_WRITE rights are how path_open determines if a descriptor is to be opened for reading, writing, or both.

The fix is as follows:

Preview 2's wit definition was unintentionally (per @sunfishcode) missing a way for filesystem.{read,write,append}-via-stream to return an error-code when a descriptor cannot be used to create such a stream. I added this to the wit definition in order to make the preview 2 behavior match the legacy implementation.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:47):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:50):

pchickey edited PR #6463:

This is an upstreaming of #6462

https://github.com/bytecodealliance/wasmtime/pull/6265 introduced a regression with programs using wasi-libc, reported at https://github.com/WebAssembly/wasi-libc/issues/415.

Wasi-libc read the rights of the base directory (using fd_fdstat_get) and used those to mask the rights requested to path_open. In 6265, I changed the behavior of fdstat_get to always report and empty set of rights. This means that Wasi-libc will always pass an empty set of rights to path_open, which is a problem because the FD_READ and FD_WRITE rights are how path_open determines if a descriptor is to be opened for reading, writing, or both.

The fix is as follows:

Preview 2's wit definition was unintentionally (per @sunfishcode) missing a way for filesystem.{read,write,append}-via-stream to return an error-code when a descriptor cannot be used to create such a stream. I added this to the wit definition in order to make the preview 2 behavior match the legacy implementation.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:50):

pchickey has marked PR #6463 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:50):

pchickey requested itsrainy for a review on PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:50):

pchickey requested wasmtime-core-reviewers for a review on PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:54):

pchickey requested wasmtime-default-reviewers for a review on PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:54):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:56):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 17:58):

pchickey has enabled auto merge for PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 20:32):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 20:33):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2023 at 20:33):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 30 2023 at 20:23):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 30 2023 at 21:08):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 30 2023 at 22:21):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 30 2023 at 22:24):

pchickey updated PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 30 2023 at 22:35):

pchickey requested sunfishcode for a review on PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (May 30 2023 at 22:49):

sunfishcode submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 30 2023 at 23:34):

pchickey merged PR #6463.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 23 2024 at 19:32):

squeek502 commented on PR #6463:

The bug that this fixed has regressed in certain ways. Reproduction here: https://github.com/WebAssembly/wasi-libc/issues/415#issuecomment-2244254211


Last updated: Dec 23 2024 at 13:07 UTC