From owner-p4-projects@FreeBSD.ORG Thu Oct 16 08:17:18 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5C4F016A4C0; Thu, 16 Oct 2003 08:17:18 -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 3813B16A4B3 for ; Thu, 16 Oct 2003 08:17:18 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D1B2643FEC for ; Thu, 16 Oct 2003 08:17:16 -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 h9GFHGXJ094018 for ; Thu, 16 Oct 2003 08:17:16 -0700 (PDT) (envelope-from cvance@nailabs.com) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9GFHGC5094015 for perforce@freebsd.org; Thu, 16 Oct 2003 08:17:16 -0700 (PDT) (envelope-from cvance@nailabs.com) Date: Thu, 16 Oct 2003 08:17:16 -0700 (PDT) Message-Id: <200310161517.h9GFHGC5094015@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 39790 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: Thu, 16 Oct 2003 15:17:18 -0000 http://perforce.freebsd.org/chv.cgi?CH=39790 Change 39790 by cvance@cvance_osx_laptop on 2003/10/16 08:17:02 Add another small batch of vnode entry points. Affected files ... .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_descrip.c#2 edit .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/uipc_usrreq.c#2 edit .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/vfs/vfs_syscalls.c#3 edit .. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/vfs/vfs_vnops.c#3 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_descrip.c#2 (text+ko) ==== ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/uipc_usrreq.c#2 (text+ko) ==== @@ -597,6 +597,11 @@ vattr.va_type = VSOCK; vattr.va_mode = (ACCESSPERMS & ~p->p_fd->fd_cmask); VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); +#ifdef MAC + error = mac_check_vnode_create(p->p_ucred, nd.ni_dvp, &nd.ni_cnd, + &vattr); + if (error == 0) +#endif error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); #if 0 /* In FreeBSD create leave s parent held ; not here */ ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/vfs/vfs_syscalls.c#3 (text+ko) ==== @@ -1154,6 +1154,11 @@ break; } } +#ifdef MAC + if (error == 0 && !whiteout) + error = mac_check_vnode_create(p->p_ucred, nd.ni_dvp, + &nd.ni_cnd, &vattr); +#endif if (!error) { VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); if (whiteout) { @@ -1214,6 +1219,12 @@ VATTR_NULL(&vattr); vattr.va_type = VFIFO; vattr.va_mode = (uap->mode & ALLPERMS) &~ p->p_fd->fd_cmask; +#ifdef MAC + error = mac_check_vnode_create(p->p_ucred, nd.ni_dvp, &nd.ni_cnd, + &vattr); + if (error) + return (error); +#endif VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); return (VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr)); #endif /* FIFO */ @@ -1314,6 +1325,13 @@ } VATTR_NULL(&vattr); vattr.va_mode = ACCESSPERMS &~ p->p_fd->fd_cmask; +#ifdef MAC + vattr.va_type = VLNK; + error = mac_check_vnode_create(p->p_ucred, nd.ni_dvp, &nd.ni_cnd, + &vattr); + if (error) + goto out; +#endif VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path); out: @@ -1403,6 +1421,11 @@ error = EBUSY; } +#ifdef MAC + if (!error) + error = mac_check_vnode_delete(p->p_ucred, nd.ni_dvp, vp, + &nd.ni_cnd); +#endif if (!error) { VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); error = VOP_REMOVE(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd); @@ -1965,6 +1988,10 @@ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); VATTR_NULL(&vattr); vattr.va_mode = uap->mode & ALLPERMS; +#ifdef MAC + error = mac_check_vnode_setmode(p->p_ucred, vp, vattr.va_mode); + if (error == 0) +#endif error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); vput(vp); return (error); @@ -1996,6 +2023,10 @@ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); VATTR_NULL(&vattr); vattr.va_mode = uap->mode & ALLPERMS; +#ifdef MAC + error = mac_check_vnode_setmode(p->p_ucred, vp, vattr.va_mode); + if (error == 0) +#endif error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); return (error); @@ -2691,6 +2722,12 @@ VATTR_NULL(&vattr); vattr.va_type = VDIR; vattr.va_mode = (uap->mode & ACCESSPERMS) &~ p->p_fd->fd_cmask; +#ifdef MAC + error = mac_check_vnode_create(p->p_ucred, nd.ni_dvp, &nd.ni_cnd, + &vattr); + if (error) + return (error); +#endif VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); if (!error) @@ -2738,6 +2775,11 @@ if (vp->v_flag & VROOT) error = EBUSY; out: +#ifdef MAC + if (!error) + error = mac_check_vnode_delete(p->p_ucred, nd.ni_dvp, vp, + &nd.ni_cnd); +#endif if (!error) { VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); @@ -2883,6 +2925,10 @@ } if (lvp != NULLVP) { +#ifdef MAC + error = mac_check_vnode_readdir(p->p_ucred, lvp); + if (!error) +#endif error = VOP_OPEN(lvp, FREAD, fp->f_cred, p); if (error) { vput(lvp); ==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/vfs/vfs_vnops.c#3 (text+ko) ==== @@ -126,6 +126,11 @@ if (fmode & O_EXCL) vap->va_vaflags |= VA_EXCLUSIVE; VOP_LEASE(ndp->ni_dvp, p, cred, LEASE_WRITE); +#ifdef MAC + error = mac_check_vnode_create(cred, ndp->ni_dvp, + &ndp->ni_cnd, vap); + if (error == 0) +#endif if (error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp, &ndp->ni_cnd, vap)) return (error);