Uh oh!
There was an error while loading. Please reload this page.
Do not allow truncating files which are not opened for writing. - #570
Do not allow truncating files which are not opened for writing.#570marmistrz wants to merge 1 commit into
Conversation
Currently the
After more discussion, I think the WASI spec is correct and the test case needs to be fixed to assert the |
sunfishcode
left a comment
There was a problem hiding this comment.
That looks right to me. Do we have a test for this in crates/wasi-misc-tests?
marmistrz
commented
Nov 14, 2019
No, currently we only check if we can truncate the file without The way I see it, we should do four tests.
On the other hand, I'm currently confused about the current implementation. The way I understand what it does. We pass This sounds completely wrong. Anyway, I don't really get what initial rights mean, as used in the WASI spec. |
kubkon
commented
Nov 15, 2019
Would you mind modifying the test to include this then?
By "we pass BTW, did you guys realise that, on Unix, you can
AFAIK initial in this context means that they are the maximum rights the fd can have, but the implementation can strip some of them away provided they don't conflict with the minimum required by the type of the fd. Anyhow, that's my understanding. I hope I didn't confuse anyone too much. @sunfishcode, as the original creator of |
peterhuene
commented
Nov 15, 2019
The However, on all platforms, write access to the file being created is required to properly truncate a file. We only check the flags passed to So is the test wrong and should pass in a right to cause the file to be open writable or should we be deducing that it should open writable if we're inheriting |
marmistrz
commented
Nov 15, 2019
Sure, I'll modify the test. One problem I can see is that currently
Well, I meant both I still claim that we're passing
Then with |
kubkon
commented
Nov 15, 2019
Yeah, AFAIK in WASI we can only every drop rights, never add more. So I guess you could do two opens, dropping
That's correct. If the parent fd doesn't possess the combination of both, then we should throw
Hmm, but the required rights are part of the
Actually, the Well, I believe we still ensure we possess the right rights by checking that the |
marmistrz
commented
Nov 17, 2019
@kubkon, you were right about the fact that we're correctly validating the permissions in The semantics of the So the question: for any inheriting right of the parent descriptor, when should the child descriptor also have this right? Always or only when requested explicitly? I attempted to sanitize ... we really do need more precise docs about the semantics of |
I wouldn't say completely wrong, rather, unfortunate. As we discussed above, Linux/Unix are not much different in that they also require at least one of
Agreed, better docs with some examples/guides would go a long way. But we can probably work that out as we go along. |
marmistrz
commented
Nov 17, 2019
@kubkon, the problem is that the public API has no absolutely no way of indicating read/write intent. Probably we should add more flags to |
marmistrz
commented
Nov 17, 2019
I think I know what the initial from the WASI spec could mean: that these are the rights that the fd will possess until the rights are set using |
peterhuene
commented
Nov 22, 2019
So what do we think the correct course of action is with this PR? The failing |
@peterhuene I guess we need to first resolve #617 and #618. As for me, it's fine to merge #557 so that it passes the current version of |
kubkon
commented
Nov 22, 2019
I agree with @marmistrz that we should clarify #617 and #618. However, in the meantime, in order not to thwart progress, I'd suggest modifying the |
marmistrz
commented
Nov 22, 2019
GitHub auto-closed this issue after a force push |
@kubkon the problem is that we need to support I extended the testcase to include the |
Subscribe to Label ActionThis issue or pull request has been labeled: "w", "a", "s", "i", ":", "m", "p", "l" To subscribe or unsubscribe from this label, edit the |
1 similar comment
Subscribe to Label ActionThis issue or pull request has been labeled: "w", "a", "s", "i", ":", "m", "p", "l" To subscribe or unsubscribe from this label, edit the |
alexcrichton
commented
Feb 22, 2024
I'm looking at some older PRs on Wasmtime and this is a prtty old one at this point. I'm going to close this since it's not super actionable given its age any more. Nowadays though changes like this are probably best done through the WASI proposal repositories if someone ends up coming across this again now or in the future. |
This came up in #557. I don't know if the Windows implementation is affected.
cc @peterhuene@kubkon@sunfishcode