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

Fixes incorrect guest fd encoding #173

Merged
merged 1 commit into from
Jun 19, 2019
Merged

Fixes incorrect guest fd encoding #173

merged 1 commit into from
Jun 19, 2019

Conversation

kubkon
Copy link
Member

@kubkon kubkon commented Jun 9, 2019

Surfaced when running sunfishcode/misc-tests. When trying to truncate the file without the __WASI_RIGHT_PATH_FILESTAT_SET_SIZE right, error __WASI_ENOTCAPABLE was correctly returned, however, the guest fd pointer was not encoded to -1 in that case. This commit fixes it by taking out the guest fd encoding out of the conditional branch which turns out obsolete.

To elaborate, before this fix, if everything was successful, host_fd with the resultant file descriptor value would be correctly encoded inside the fd pointer. However, if there was an error in host::wasmtime_ssp_path_open call, the host_fd would correctly store wasm32::__wasi_fd_t::max_value() (equivalent to -1) but fd pointer would be untouched due to the encoding operation being behind an if statement which would be triggered only when path_open was successful.

Surfaced when running sunfishcode/misc-tests. When trying to
truncate the file without the __WASI_RIGHT_PATH_FILESTAT_SET_SIZE
right, error __WASI_ENOTCAPABLE was correctly returned, however,
the guest fd pointer was not encoded to -1 in that case. This
commit fixes it by taking out the guest fd encoding out of the
conditional branch which turns out obsolete.
@sunfishcode
Copy link
Member

Makes sense.

@sunfishcode sunfishcode merged commit 7ac6666 into bytecodealliance:master Jun 19, 2019
@kubkon kubkon deleted the wasi-c-fix branch June 19, 2019 15:48
kubkon pushed a commit that referenced this pull request Nov 7, 2019
* Bump crate versions.

* Update dependency version numbers too.

This is a follow-up to f96b6c9e72ae50fcddd488be47a2d4b5ac7b926b to
update the version numbers in the local dependencies too.
grishasobol pushed a commit to grishasobol/wasmtime that referenced this pull request Nov 29, 2021
…ance#173)

* Add a check if NotStartedModuleRef has a start function

* Removed redundant doc comment

Co-Authored-By: elichai <elichai.turkel@gmail.com>
dhil pushed a commit to dhil/wasmtime that referenced this pull request May 16, 2024
)

The C API for using the wasmtime linker currently only gives access to
the `allow_shadowing` setting of the linker, but not to the
`allow_unknown_exports` setting. However, the latter setting needs to be
enabled in order to allow exporting the global `__stack_pointer`. This
is what's causing the issue described in wasmfx/waeio#2.

(Alternatively, we may add `__stack_pointer` to the list of blessed
globals in the `command` function in
crates/wasmtime/src/runtime/linker.rs, but the comments there suggest
that new items shouldn't be added to that list. Therefore, just making
this setting accessible in the C API seems less controversial.)
avanhatt pushed a commit to wellesley-prog-sys/wasmtime that referenced this pull request Oct 23, 2024
Generate spec for `MInst.VecLanes`, required for `popcnt` lowering.

Updates avanhatt#34 avanhatt#35
avanhatt pushed a commit to wellesley-prog-sys/wasmtime that referenced this pull request Oct 23, 2024
Generate spec for `MInst.VecLanes`, required for `popcnt` lowering.

Updates avanhatt#34 avanhatt#35
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