Date: Wed, 28 Mar 2018 14:39:56 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331679 - in stable/11: lib/libc/sys sys/compat/freebsd32 sys/kern Message-ID: <201803281439.w2SEduwu001535@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Wed Mar 28 14:39:56 2018 New Revision: 331679 URL: https://svnweb.freebsd.org/changeset/base/331679 Log: 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 Modified: stable/11/lib/libc/sys/posix_fallocate.2 stable/11/sys/compat/freebsd32/capabilities.conf stable/11/sys/kern/capabilities.conf stable/11/sys/kern/vfs_syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/posix_fallocate.2 ============================================================================== --- stable/11/lib/libc/sys/posix_fallocate.2 Wed Mar 28 14:35:24 2018 (r331678) +++ stable/11/lib/libc/sys/posix_fallocate.2 Wed Mar 28 14:39:56 2018 (r331679) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd January 23, 2014 +.Dd October 12, 2017 .Dt POSIX_FALLOCATE 2 .Os .Sh NAME @@ -118,6 +118,10 @@ argument does not refer to a regular file. .It Bq Er ENOSPC There is insufficient free space remaining on the file system storage media. +.It Bq Er ENOTCAPABLE +The file descriptor +.Fa fd +has insufficient rights. .It Bq Er ESPIPE The .Fa fd Modified: stable/11/sys/compat/freebsd32/capabilities.conf ============================================================================== --- stable/11/sys/compat/freebsd32/capabilities.conf Wed Mar 28 14:35:24 2018 (r331678) +++ stable/11/sys/compat/freebsd32/capabilities.conf Wed Mar 28 14:39:56 2018 (r331679) @@ -196,6 +196,7 @@ pdkill freebsd32_pipe pipe2 poll +freebsd32_posix_fallocate freebsd32_pread freebsd32_preadv profil Modified: stable/11/sys/kern/capabilities.conf ============================================================================== --- stable/11/sys/kern/capabilities.conf Wed Mar 28 14:35:24 2018 (r331678) +++ stable/11/sys/kern/capabilities.conf Wed Mar 28 14:39:56 2018 (r331679) @@ -495,6 +495,7 @@ poll ## ## Allow I/O-related file descriptors, subject to capability rights. ## +posix_fallocate pread preadv Modified: stable/11/sys/kern/vfs_syscalls.c ============================================================================== --- stable/11/sys/kern/vfs_syscalls.c Wed Mar 28 14:35:24 2018 (r331678) +++ stable/11/sys/kern/vfs_syscalls.c Wed Mar 28 14:39:56 2018 (r331679) @@ -4163,7 +4163,7 @@ kern_posix_fallocate(struct thread *td, int fd, off_t /* 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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803281439.w2SEduwu001535>