Date: Thu, 16 Oct 2003 08:17:16 -0700 (PDT) From: Chris Vance <cvance@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 39790 for review Message-ID: <200310161517.h9GFHGC5094015@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200310161517.h9GFHGC5094015>