diff options
author | emaste <emaste@FreeBSD.org> | 2018-03-28 14:39:56 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2018-03-28 14:39:56 +0000 |
commit | 232a0597ebf908a011544eb3ca776206859ab837 (patch) | |
tree | 8b3901e4704f749224d943f3b8c68140f0b7a90c /sys/kern | |
parent | f3586d9721e4e5a2a22361e86e06bb07476927c9 (diff) | |
download | FreeBSD-src-232a0597ebf908a011544eb3ca776206859ab837.zip FreeBSD-src-232a0597ebf908a011544eb3ca776206859ab837.tar.gz |
MFC r324560: allow posix_fallocate in capability mode
posix_fallocate is logically equivalent to writing zero blocks to the
desired file size and there is no reason to prevent calling it in
capability mode. posix_fallocate already checked for the CAP_WRITE
right, so we merely need to list it in capabilities.conf.
Also MFC r324564: allow posix_fallocate in 32-bit compat capability mode
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/capabilities.conf | 1 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/capabilities.conf b/sys/kern/capabilities.conf index 693c024..ca3f4b7 100644 --- a/sys/kern/capabilities.conf +++ b/sys/kern/capabilities.conf @@ -495,6 +495,7 @@ poll ## ## Allow I/O-related file descriptors, subject to capability rights. ## +posix_fallocate pread preadv diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 219e862..e5bb4d9 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -4163,7 +4163,7 @@ kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) /* Check for wrap. */ if (offset > OFF_MAX - len) return (EFBIG); - error = fget(td, fd, cap_rights_init(&rights, CAP_WRITE), &fp); + error = fget(td, fd, cap_rights_init(&rights, CAP_PWRITE), &fp); if (error != 0) return (error); if ((fp->f_ops->fo_flags & DFLAG_SEEKABLE) == 0) { |