crosvm/seccomp/x86_64/9p_device.policy
Daniel Verkamp 53cd18e062 p9: use *at() functions for set_attr
Use fchmodat(), fchownat(), and utimensat() to implement the SET_ATTR
request rather than using the non-'at' variants of these functions.
These can operate on a file descriptor path using the /proc file handle
and "self/fd/N" filename to modify the attributes of a file without
actually opening it, which means we can avoid problems like not being
able to open a read-only file with O_RDWR, which happened previously
with chmod requests.

This means we don't need to open the file at all, except in the case of
a request that needs to set the size, since there is no equivalent
truncateat() function.

BUG=chromium:1369647
TEST=touch /mnt/chromeos/MyFiles/Downloads/hello.txt
TEST=chmod -w /mnt/chromeos/MyFiles/Downloads/hello.txt
TEST=chmod +w /mnt/chromeos/MyFiles/Downloads/hello.txt
TEST=chmod a-r /mnt/chromeos/MyFiles/Downloads/hello.txt
TEST=chmod a+r /mnt/chromeos/MyFiles/Downloads/hello.txt
TEST=chown $USER /mnt/chromeos/MyFiles/Downloads/hello.txt
TEST=truncate -s1 /mnt/chromeos/MyFiles/Downloads/hello.txt

Change-Id: I0461ed231cc78b26bcc37ede1a364af984c87f8b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3935537
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-10-10 17:50:07 +00:00

33 lines
511 B
Text

# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
open: 1
openat: 1
@include /usr/share/policy/crosvm/common_device.policy
pwrite64: 1
stat: 1
statx: 1
fstat: 1
ioctl: arg1 == FIOCLEX
linkat: 1
unlinkat: 1
renameat: 1
pread64: 1
lseek: 1
getdents64: 1
mkdirat: 1
rmdir: 1
fsync: 1
fdatasync: 1
utimensat: 1
ftruncate: 1
fchmod: 1
fchmodat: 1
fchown: 1
fchownat: 1
fstatfs: 1
newfstatat: 1
prctl: arg0 == PR_SET_NAME