crosvm/seccomp/arm
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
..
9p_device.policy p9: use *at() functions for set_attr 2022-10-10 17:50:07 +00:00
balloon_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
battery.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
block_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
coiommu_device.policy health-check: enforce blank line after copyright 2022-09-13 22:24:35 +00:00
common_device.policy dev_container: Upgrade to debian bookworm 2022-09-14 22:32:36 +00:00
cras_audio_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
fs_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
gpu_common.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
gpu_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
gpu_render_server.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
input_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
net_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
null_audio_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
pmem_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
rng_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
serial.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
serial_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
snd_cras_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
snd_null_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
tpm_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
vhost_net_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
vhost_vsock_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
video_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
vios_audio_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
wl_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
xhci_device.policy Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00