From owner-p4-projects@FreeBSD.ORG Thu Oct 23 18:11:13 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B0C7E16A4C0; Thu, 23 Oct 2003 18:11:12 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F67B16A4B3 for ; Thu, 23 Oct 2003 18:11:12 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D442943F3F for ; Thu, 23 Oct 2003 18:11:11 -0700 (PDT) (envelope-from cvance@nailabs.com) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h9O1BBXJ007378 for ; Thu, 23 Oct 2003 18:11:11 -0700 (PDT) (envelope-from cvance@nailabs.com) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9O1BB6a007374 for perforce@freebsd.org; Thu, 23 Oct 2003 18:11:11 -0700 (PDT) (envelope-from cvance@nailabs.com) Date: Thu, 23 Oct 2003 18:11:11 -0700 (PDT) Message-Id: <200310240111.h9O1BB6a007374@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to cvance@nailabs.com using -f From: Chris Vance To: Perforce Change Reviews Subject: PERFORCE change 40354 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2003 01:11:13 -0000 http://perforce.freebsd.org/chv.cgi?CH=40354 Change 40354 by cvance@cvance_osx_laptop on 2003/10/23 18:10:19 Add vnode read,write, and stat entry points Affected files ... .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_ktrace.c#3 edit .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/vfs/vfs_syscalls.c#4 edit .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/vfs/vfs_vnops.c#4 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_ktrace.c#3 (text+ko) ==== @@ -562,6 +562,10 @@ if (error) goto bad; (void)VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); +#ifdef MAC + error = mac_check_vnode_write(p->p_ucred, NOCRED, vp); + if (error == 0) +#endif error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, p->p_ucred); if (error == 0 && uio != NULL) { (void)VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/vfs/vfs_syscalls.c#4 (text+ko) ==== @@ -1061,6 +1061,12 @@ type = F_FLOCK; if ((flags & FNONBLOCK) == 0) type |= F_WAIT; +#ifdef MAC_XXX + error = mac_check_file_change_flags(p->p_ucred, fp, + fp->f_flag, fp->f_flag | FHASLOCK); + if (error) + return (error); +#endif VOP_UNLOCK(vp, 0, p); if (error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, type)) { (void) vn_close(vp, fp->f_flag, fp->f_cred, p); @@ -2260,6 +2266,10 @@ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); if (vp->v_type == VDIR) error = EISDIR; +#ifdef MAC + else if ((error = mac_check_vnode_write(p->p_ucred, NOCRED, vp))) { + } +#endif else if ((error = vn_writechk(vp)) == 0 && (error = VOP_ACCESS(vp, VWRITE, p->p_ucred, p)) == 0) { VATTR_NULL(&vattr); @@ -2311,6 +2321,10 @@ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); if (vp->v_type == VDIR) error = EISDIR; +#ifdef MAC + else if ((error = mac_check_vnode_write(p->p_ucred, fp->f_cred, vp))) { + } +#endif else if ((error = vn_writechk(vp)) == 0) { VATTR_NULL(&vattr); vattr.va_size = uap->length; ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/vfs/vfs_vnops.c#4 (text+ko) ==== @@ -162,6 +162,12 @@ goto bad; } +#ifdef MAC + error = mac_check_vnode_open(cred, vp, fmode); + if (error) + goto bad; +#endif + #if DIAGNOSTIC if (UBCINFOMISSING(vp)) panic("vn_open: ubc_info_init"); @@ -298,7 +304,14 @@ auio.uio_rw = rw; auio.uio_procp = p; +#ifdef MAC + /* passed cred is fp->f_cred */ if (rw == UIO_READ) + error = mac_check_vnode_read(p->p_ucred, cred, vp); + else + error = mac_check_vnode_write(p->p_ucred, cred, vp); +#endif +if (rw == UIO_READ) error = VOP_READ(vp, &auio, ioflg, cred); else error = VOP_WRITE(vp, &auio, ioflg, cred); @@ -387,6 +400,10 @@ goto done; } } +#ifdef MAC + error = mac_check_vnode_read(p->p_ucred, cred, vp); + if (error == 0) +#endif error = VOP_READ(vp, uio, ioflag, cred); if ((flags & FOF_OFFSET) == 0) fp->f_offset += count - uio->uio_resid; @@ -478,6 +495,10 @@ goto done; } } +#ifdef MAC + error = mac_check_vnode_write(p->p_ucred, cred, vp); + if (error == 0) +#endif error = VOP_WRITE(vp, uio, ioflag, cred); if ((flags & FOF_OFFSET) == 0) { @@ -513,6 +534,12 @@ int error; u_short mode; +#ifdef MAC + error = mac_check_vnode_stat(p->p_ucred, NOCRED, vp); + if (error) + return (error); +#endif + vap = &vattr; error = VOP_GETATTR(vp, vap, p->p_ucred, p); if (error)