-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Implicit "read" access when no rights specified in path_open on Unix #617
Comments
I also created a test exposing this behavior: #618. We get read access even if we literally drop the right to call |
The reason for opening with
Linux has |
@sunfishcode it seems that our Unix impl still allows |
The problem is that the derived fd will implicitly receive |
I don't personally have much to add here myself unfortunately, I'd be happy with whatever outcome! |
When discussing base and inheriting rights in
path_open
in #570, we've discovered that, on Unix, our implementation ofpath_open
will implicitly open the derived descriptor with "read" access even when bothrights_base
andrights_inheriting
are set to0
. @marmistrz and I have since been wondering whether this is the intended behaviour or not (for reference, here's the link to the offending bit: sys/unix/hostcalls_impl/fs.rs#L102). Note further that, if you specify__WASI_RIGHT_FD_WRITE
, we don't implicitly inherit the read right. All in all then, the possible states forrights_base
currently are:0
implies "read" access__WASI_RIGHT_FD_READ
implies "read" access__WASI_RIGHT_FD_WRITE
implies "write" access__WASI_RIGHT_FD_READ | __WASI_RIGHT_FD_WRITE
implies "read-write" accessThis could have a potential unexpected behaviour in implementations wrapping the WASI syscalls such as
std::fs::OpenOptions
which assumes that__WASI_RIGHT_FD_READ
is acquired only if the client has indeed specified that they want the path opened for reading which with the current behaviour will not always be the case. Here's the link to the relevant implementation bit in Rust: sys/wasi/fs.rs#L332.The text was updated successfully, but these errors were encountered: