[9.0.0] fix Wasi rights system to work with wasi-libc #6462
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#6265 introduced a regression with programs using wasi-libc, reported at WebAssembly/wasi-libc#415.
Wasi-libc read the rights of the base directory (using
fd_fdstat_get
) and used those to mask the rights requested topath_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 topath_open
, which is a problem because theFD_READ
andFD_WRITE
rights are how path_open determines if a descriptor is to be opened for reading, writing, or both.The fix is as follows:
fd_fdstat_get
.FD_READ
andFD_WRITE
bits infs_rights_base
for a file'sfd_fdstat_get
.fd_read
andfd_write
This PR is just for the
release-9.0.0
branch, I will work on upstreaming it tomain
but the situation there is slightly more complex because the test also needs to pass under the preview 2 implementation.