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

Allow WASI preopen file descriptors to be closed. #5828

Merged

Conversation

sunfishcode
Copy link
Member

Early on in WASI, we weren't sure whether we should allow preopens to be closed, so conservatively, we disallowed them. Among other things, this protected assumptions in wasi-libc that it can hold onto preopen file descriptors and rely on them always being open.

However now, I think it makes sense to relax this restriction. wasi-libc itself doesn't expose the preopen file descriptors, so users shouldn't ever be closing them naively, unless they have wild closes. And toolchains other than wasi-libc may want to close preopens as a way to drop priveleges once the main file handles are opened.

Early on in WASI, we weren't sure whether we should allow preopens to be
closed, so conservatively, we disallowed them. Among other things, this
protected assumptions in wasi-libc that it can hold onto preopen file
descriptors and rely on them always being open.

However now, I think it makes sense to relax this restriction. wasi-libc
itself doesn't expose the preopen file descriptors, so users shouldn't
ever be closing them naively, unless they have wild closes. And
toolchains other than wasi-libc may want to close preopens as a way to
drop priveleges once the main file handles are opened.
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Feb 18, 2023
@github-actions
Copy link

Subscribe to Label Action

cc @kubkon

This issue or pull request has been labeled: "wasi"

Thus the following users have been cc'd because of the following labels:

  • kubkon: wasi

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@sunfishcode sunfishcode added this pull request to the merge queue Feb 24, 2023
Merged via the queue into bytecodealliance:main with commit 67e2e57 Feb 24, 2023
@sunfishcode sunfishcode deleted the sunfishcode/close-preopens branch February 24, 2023 21:50
sunfishcode added a commit to bytecodealliance/preview2-prototyping that referenced this pull request Feb 25, 2023
This ports the test updates from bytecodealliance/wasmtime#5828 to the
preview2-prototype and implements the ability to close preopened file
descriptors.
sunfishcode added a commit to bytecodealliance/preview2-prototyping that referenced this pull request Feb 25, 2023
This ports the test updates from bytecodealliance/wasmtime#5828 to the
preview2-prototype and implements the ability to close preopened file
descriptors.
sunfishcode added a commit to bytecodealliance/preview2-prototyping that referenced this pull request Feb 27, 2023
* Allow preopen file descriptors to be closed.

This ports the test updates from bytecodealliance/wasmtime#5828 to the
preview2-prototype and implements the ability to close preopened file
descriptors.

* Fix compilation on Windows.
pchickey pushed a commit to pchickey/wasmtime that referenced this pull request May 16, 2023
* Allow preopen file descriptors to be closed.

This ports the test updates from bytecodealliance#5828 to the
preview2-prototype and implements the ability to close preopened file
descriptors.

* Fix compilation on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi Issues pertaining to WASI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants