-
Notifications
You must be signed in to change notification settings - Fork 274
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
Support more than 64 rights #63
Comments
This sounds better to me for the future. |
I think it would be better to add an extra argument to |
There is a separate problem I see... why are If we can break apart "classes" of rights, would 64 be enough? If we needed more, we could simply add functions ( I suppose this could leave a vulnerability where you might be allowing rights through in the second group (
Retrieving the existing rights and using a bitmask should easily solve this problem though, although it may be more expensive. |
There are also similar constants where the argument could be made that they should be arrays for forwards-compatibility guarantees, i.e. __wasi_fdflags_t which is currently only a 16bit integer. |
FWIW, if/when WASI export signatures get interface-type'd, one could imagine that bit-vectors could be replaced, without meaningful loss of efficiency, by record types (with named bool fields). The expectation here is the the adapter instructions for creating records would statically declare field names and so the compiler would have all the knowledge and freedom to pack the bools as much as it wanted. |
In the WASI Preview2 presentation, I proposed removing the rights system altogether, and no one objected. A few notes:
|
Sets of rights (e.g.
__WASI_RIGHT_FD_READ
) are currently encoded as a 64-bit bitmask:This limits the API to 64 rights, of which 29 are currently used. It seems likely that WASI will exceed that limit at some point. The simple solution would be to just double or quadruple the width of
__wasi_rights_t
. Maybe 128 or 256 rights is enough?A more complex solution would be to make everywhere that deals with rights take a variable length array of 64-bit masks. An API version could define a maximum length, so both sides of the API could use statically sized arrays. As long as the API functions take a dynamic length argument, their signature doesn't need to change if the maximum length increases.
There's also an issue with the current
fd_fdstat_set_rights
function (or thehandle_set_rights
of #62): it can only be used to remove rights, but it's easy to accidentally remove rights you don't know about! It should perhaps take a set of rights to remove, instead of a set of rights to keep.The text was updated successfully, but these errors were encountered: