From owner-p4-projects@FreeBSD.ORG Thu Jul 18 21:36:14 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 918AFA64; Thu, 18 Jul 2013 21:36:14 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5377BA62 for ; Thu, 18 Jul 2013 21:36:14 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [8.8.178.74]) by mx1.freebsd.org (Postfix) with ESMTP id 44869AA0 for ; Thu, 18 Jul 2013 21:36:14 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id r6ILaE8g014018 for ; Thu, 18 Jul 2013 21:36:14 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.6/Submit) id r6ILaEpb014015 for perforce@freebsd.org; Thu, 18 Jul 2013 21:36:14 GMT (envelope-from brooks@freebsd.org) Date: Thu, 18 Jul 2013 21:36:14 GMT Message-Id: <201307182136.r6ILaEpb014015@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 231264 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jul 2013 21:36:15 -0000 http://p4web.freebsd.org/@@231264?ac=10 Change 231264 by brooks@brooks_zenith on 2013/07/18 21:36:08 When we read, write, or truncate a file via most applicable syscalls, ensure that we checked for the correct capability when translating from file descriptor to struct file. Affected files ... .. //depot/projects/ctsrd/tesla/src/sys/kern/vfs_vnops.c#3 edit Differences ... ==== //depot/projects/ctsrd/tesla/src/sys/kern/vfs_vnops.c#3 (text+ko) ==== @@ -68,10 +68,16 @@ #include #include #include +#include +#include +#include #include #include +#include +#include + #include #include #include @@ -707,6 +713,10 @@ } offset = uio->uio_offset; + TESLA_WITHIN(kern_readv, previously(fget_unlocked(ANY(ptr), ANY(int), + bitmask(CAP_READ), ANY(int), &fp, ANY(ptr)) == 0)); + TESLA_WITHIN(kern_preadv, previously(fget_unlocked(ANY(ptr), ANY(int), + bitmask(CAP_PREAD), ANY(int), &fp, ANY(ptr)) == 0)); #ifdef MAC error = mac_vnode_check_read(active_cred, fp->f_cred, vp); if (error == 0) @@ -812,6 +822,10 @@ } offset = uio->uio_offset; + TESLA_WITHIN(kern_writev, previously(fget_unlocked(ANY(ptr), ANY(int), + bitmask(CAP_WRITE), ANY(int), &fp, ANY(ptr)) == 0)); + TESLA_WITHIN(kern_pwritev, previously(fget_unlocked(ANY(ptr), ANY(int), + bitmask(CAP_PWRITE), ANY(int), &fp, ANY(ptr)) == 0)); #ifdef MAC error = mac_vnode_check_write(active_cred, fp->f_cred, vp); if (error == 0) @@ -1200,6 +1214,8 @@ if (error) goto out; #endif + TESLA_WITHIN(kern_ftruncate, previously(fget_unlocked(ANY(ptr), + ANY(int), bitmask(CAP_FTRUNCATE), ANY(int), &fp, ANY(ptr)) == 0)); error = vn_writechk(vp); if (error == 0) { VATTR_NULL(&vattr);