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

O_RESOLVE_BENEATH is forced #475

Open
yamt opened this issue Feb 22, 2024 · 4 comments
Open

O_RESOLVE_BENEATH is forced #475

yamt opened this issue Feb 22, 2024 · 4 comments

Comments

@yamt
Copy link
Contributor

yamt commented Feb 22, 2024

in posix, openat(dirfd, "../b", ...) should work.
however, in wasi, O_RESOLVE_BENEATH behavior is unconditionally applied. (at least in popular implementations. i don't know if it was well documented for preview1. but for later versions, see https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md.)
wasi-ilbc doesn't seem to emulate the posix behavior either.

@sbc100
Copy link
Member

sbc100 commented Feb 22, 2024

I don't see any reference to O_RESOLVE_BENEATH in musl, or indeed anywhere on my linux system. Are you sure its part of POSIX? It doesn't seem to be part of either glibc or musl. Can you point to some documentation related to it? I couldn't find anything aside from stuff in freebsd.

@sunfishcode
Copy link
Member

@yamt Yes, this is behavior we inherited from CloudABI. Directory handles act as O_RESOLVE_BENEATH sandboxes.

I now believe we can migrate toward having a rooted filesystem, as I posted about here, which I expect will address your concerns, as many use cases that want "POSIX" can just use the filesystem namespace and things like ".." would work within it.

That said, there are use cases for handles with O_RESOLVE_BENEATH behavior, so we might keep that functionality around even as we also add a namespace.

@yamt
Copy link
Contributor Author

yamt commented Feb 28, 2024

I don't see any reference to O_RESOLVE_BENEATH in musl, or indeed anywhere on my linux system. Are you sure its part of POSIX? It doesn't seem to be part of either glibc or musl. Can you point to some documentation related to it? I couldn't find anything aside from stuff in freebsd.

O_RESOLVE_BENEATH is non-standard. it isn't a part of posix.
even its name varies among systems.
on linux, it's called RESOLVE_BENEATH.

@yamt
Copy link
Contributor Author

yamt commented Feb 28, 2024

@yamt Yes, this is behavior we inherited from CloudABI. Directory handles act as O_RESOLVE_BENEATH sandboxes.

ok.

I now believe we can migrate toward having a rooted filesystem, as I posted about here, which I expect will address your concerns, as many use cases that want "POSIX" can just use the filesystem namespace and things like ".." would work within it.

ok. commented there.

That said, there are use cases for handles with O_RESOLVE_BENEATH behavior, so we might keep that functionality around even as we also add a namespace.

even in case we keep the functionality, it should be optional i suppose.

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

No branches or pull requests

3 participants