From owner-svn-src-stable-11@freebsd.org Wed Mar 28 14:39:57 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26647F64458; Wed, 28 Mar 2018 14:39:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF8F46E835; Wed, 28 Mar 2018 14:39:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A97874512; Wed, 28 Mar 2018 14:39:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2SEduJg001539; Wed, 28 Mar 2018 14:39:56 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2SEduwu001535; Wed, 28 Mar 2018 14:39:56 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803281439.w2SEduwu001535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 28 Mar 2018 14:39:56 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/11: lib/libc/sys sys/compat/freebsd32 sys/kern X-SVN-Commit-Revision: 331679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Mar 2018 14:39:57 -0000 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) {