crosvm/seccomp/arm
Chirantan Ekbote 44336b9131 devices: fs: Fix posix acl handling
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>
2020-06-29 10:14:42 +00:00
..
9p_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
balloon_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
block_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
common_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
cras_audio_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
fs_device.policy devices: fs: Fix posix acl handling 2020-06-29 10:14:42 +00:00
gpu_device.policy seccomp: gpu: Allow PR_GET_NAME for prctl 2020-06-25 10:33:59 +00:00
input_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
net_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
null_audio_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
pmem_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
rng_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
serial.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
tpm_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
vhost_net_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
vhost_vsock_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
video_device.policy secomp: Allow sched_yield for video device. 2020-06-26 11:35:33 +00:00
wl_device.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00
xhci.policy seccomp: remove redundant unconditional arm/arm64 rules 2020-02-04 23:27:21 +00:00