seccomp: add lseek to all devices

The panic hook calls read_to_string, which relies on lseek internally.
Most devices already allow lseek, but add it to the common policy files
to ensure that devices can properly panic.

BUG=None
TEST=compiles

Change-Id: I99d6d1d258706874cc04ce550108991631d71706
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960213
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
David Stevens 2022-10-18 09:55:51 +09:00 committed by crosvm LUCI
parent 9867495716
commit c11683b07f
30 changed files with 5 additions and 31 deletions

View file

@ -11,7 +11,6 @@ pwrite64: 1
statx: 1
fstat: 1
ioctl: arg1 == FIOCLEX
lseek: 1
getdents64: 1
fdatasync: 1
fsync: 1

View file

@ -9,7 +9,6 @@ fdatasync: 1
fstat: 1
fsync: 1
ftruncate: 1
lseek: 1
openat: return ENOENT
newfstatat: 1
preadv: 1

View file

@ -23,6 +23,7 @@ gettimeofday: 1
io_uring_setup: 1
io_uring_enter: 1
kill: 1
lseek: 1
madvise: arg2 == MADV_DONTNEED || arg2 == MADV_DONTDUMP || arg2 == MADV_REMOVE || arg2 == MADV_MERGEABLE
mmap: arg2 in ~PROT_EXEC
mprotect: arg2 in ~PROT_EXEC

View file

@ -4,7 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
lseek: 1
prlimit64: 1
setrlimit: 1
sched_setscheduler: 1

View file

@ -39,7 +39,6 @@ ioctl: arg1 == FS_IOC_FSGETXATTR || \
arg1 == 0x40806685 || \
arg1 == 0xc0046686
linkat: 1
lseek: 1
mkdirat: 1
mknodat: 1
openat: 1

View file

@ -4,7 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
lseek: 1
prlimit64: 1
setrlimit: 1
openat: return ENOENT

View file

@ -10,7 +10,6 @@ fsync: 1
ftruncate: 1
getrandom: 1
getuid: 1
lseek: 1
mkdirat: 1
newfstatat: 1
openat: 1

View file

@ -4,7 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
lseek: 1
openat: return ENOENT
prlimit64: 1
sched_setscheduler: 1

View file

@ -33,5 +33,4 @@ socket: arg0 == AF_NETLINK
ioctl: arg1 == 0xc0185500 || arg1 == 0x8038550a || arg1 == 0x8004551a || arg1 == 0x4008550d || arg1 == 0x8004550f || arg1 == 0x80045510 || arg1 == 0x80045515 || arg1 == 0x550b || arg1 == 0x5514 || arg1 == 0x80045505 || arg1 == 0x8108551b || arg1 == 0x40085511 || arg1 == 0x80185520
fstat: 1
getrandom: 1
lseek: 1
prctl: arg0 == PR_SET_NAME

View file

@ -10,7 +10,6 @@ stat64: 1
statx: 1
fstat64: 1
ioctl: arg1 == FIOCLEX
_llseek: 1
getdents64: 1
fdatasync: 1
fsync: 1

View file

@ -10,7 +10,6 @@ fstat64: 1
fstatat64: 1
fsync: 1
ftruncate64: 1
_llseek: 1
open: return ENOENT
openat: return ENOENT
pread64: 1

View file

@ -25,6 +25,8 @@ gettimeofday: 1
io_uring_setup: 1
io_uring_enter: 1
kill: 1
lseek: 1
_llseek: 1
madvise: arg2 == MADV_DONTNEED || arg2 == MADV_DONTDUMP || arg2 == MADV_REMOVE || arg2 == MADV_MERGEABLE
mmap2: arg2 in ~PROT_EXEC
mprotect: arg2 in ~PROT_EXEC

View file

@ -4,8 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
_llseek: 1
lseek: 1
open: return ENOENT
openat: return ENOENT
prlimit64: 1

View file

@ -40,7 +40,6 @@ ioctl: arg1 == FS_IOC_FSGETXATTR || \
arg1 == 0x40806685 || \
arg1 == 0xc0046686
linkat: 1
_llseek: 1
mkdir: 1
mkdirat: 1
mknodat: 1

View file

@ -4,7 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
_llseek: 1
open: return ENOENT
openat: return ENOENT
prlimit64: 1

View file

@ -10,7 +10,6 @@ fsync: 1
ftruncate: 1
getrandom: 1
getuid: 1
lseek: 1
mkdir: 1
open: 1
openat: 1

View file

@ -4,7 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
lseek: 1
open: return ENOENT
openat: return ENOENT
prlimit64: 1

View file

@ -39,7 +39,6 @@ fstat64: 1
fstatat64: 1
getrandom: 1
getdents: 1
_llseek: 1
open: return ENOENT
openat: 1
prctl: arg0 == PR_SET_NAME

View file

@ -16,7 +16,6 @@ linkat: 1
unlinkat: 1
renameat: 1
pread64: 1
lseek: 1
getdents64: 1
mkdirat: 1
rmdir: 1

View file

@ -7,7 +7,6 @@ fdatasync: 1
fstat: 1
fsync: 1
ftruncate: 1
lseek: 1
open: return ENOENT
openat: return ENOENT
newfstatat: 1

View file

@ -24,6 +24,7 @@ gettimeofday: 1
io_uring_setup: 1
io_uring_enter: 1
kill: 1
lseek: 1
madvise: arg2 == MADV_DONTNEED || arg2 == MADV_DONTDUMP || arg2 == MADV_REMOVE || arg2 == MADV_MERGEABLE
mmap: arg2 in ~PROT_EXEC
mprotect: arg2 in ~PROT_EXEC

View file

@ -4,7 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
lseek: 1
open: return ENOENT
openat: return ENOENT
prlimit64: 1

View file

@ -38,7 +38,6 @@ ioctl: arg1 == FS_IOC_FSGETXATTR || \
arg1 == 0x40806685 || \
arg1 == 0xc0046686
linkat: 1
lseek: 1
mkdir: 1
mkdirat: 1
mknodat: 1

View file

@ -4,7 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
lseek: 1
open: return ENOENT
openat: return ENOENT
prlimit64: 1

View file

@ -8,6 +8,3 @@
@include /usr/share/policy/crosvm/common_device.policy
@include /usr/share/policy/crosvm/serial.policy
# From vhost_user.policy.
lseek: arg2 == SEEK_END

View file

@ -10,7 +10,6 @@ fsync: 1
ftruncate: 1
getrandom: 1
getuid: 1
lseek: 1
mkdir: 1
newfstatat: 1
open: 1

View file

@ -8,8 +8,5 @@
# TCGETS/TCSETS: used on FD 0, probably for serial.
# b/239779171: try moving this to the serial device once we can extend ioctls across policy files.
ioctl: arg1 == FIONBIO || arg1 == TCGETS || arg1 == TCSETS
# For seeking over the received connection.
# b/239779171 : temporarily disabled as it conflicts with block's definition.
# lseek: arg2 == SEEK_END
# For accepting a client connection over the socket.
accept4: 1

View file

@ -24,6 +24,7 @@ gettimeofday: 1
io_uring_setup: 1
io_uring_enter: 1
kill: 1
lseek: 1
madvise: arg2 == MADV_DONTNEED || arg2 == MADV_DONTDUMP || arg2 == MADV_REMOVE || arg2 == MADV_MERGEABLE
mremap: 1
munmap: 1

View file

@ -4,7 +4,6 @@
@include /usr/share/policy/crosvm/common_device.policy
lseek: 1
open: return ENOENT
openat: return ENOENT
prlimit64: 1

View file

@ -40,5 +40,4 @@ newfstatat: 1
getrandom: 1
getdents: 1
getdents64: 1
lseek: 1
prctl: arg0 == PR_SET_NAME