mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
44336b9131
Posix acls are a truly incredible example of API design. The presence of a default posix acl in a directory completely changes the meaning of the `mode` parameter for all system call that create inodes. However, this new behavior only applies when the inode is first created and not for any subsequent operations that use the mode, like fchmod. When a directory has a default posix acl, all inodes created in that directory get the permissions specified in the default acl. The mode parameter is treated like a umask where any permissions allowed by the default acl that are not allowed by the mode parameter are blocked. The actual umask is ignored in this case. So to handle this properly we need to set FUSE_DONT_MASK to prevent the kernel driver from preemptively applying the umask. Then we have to check if the parent directory has a default posix acl and only apply the umask to the mode if it does not. This also means that we cannot use `mkdtemp` because that always creates directories with a mode of 0o700 and since the default posix acl calculation only applies on creation and not on later operations, we need to apply the proper mode in the very beginning. BUG=b:159285544,b:152806644 TEST=vm.Virtiofs. Use a test program to create files/directories in directories that have a default acl and ones that don't, and verify that the mode is correctly set after creation Change-Id: Ieca8ac9db391feebe5719630c5f3b57b04b71533 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2260253 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org> Auto-Submit: Chirantan Ekbote <chirantan@chromium.org> |
||
---|---|---|
.. | ||
aarch64 | ||
arm | ||
x86_64 |