Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2002 08:02:16 -0700 (PDT)
From:      Brian Feldman <green@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 14031 for review
Message-ID:  <200207101502.g6AF2GVj077852@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14031

Change 14031 by green@green_laptop_2 on 2002/07/10 08:02:13

	* Fix a bug where mac_update_vnode_from_externalized would _never_
	  get called.  (ALSO: LAZY INSTANTIATE ALL FREEBSD.MAC LABELS)
	* Remove mac_create_vnode_from_exported()

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#160 edit
.. //depot/projects/trustedbsd/mac/sys/sys/mac.h#109 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#160 (text+ko) ====

@@ -917,10 +917,19 @@
 
 	case EOPNOTSUPP:
 	case ENOATTR:
-		/* Use the label from the mountpoint. */
+		/*
+		 * Use the label from the mountpoint.  Take this opportunity
+		 * to lazy-instantiate, just for correctness.
+		 */
 		mac_update_vnode_from_mount(vp, vp->v_mount);
-		return (0);
-
+		error = mac_externalize(&vp->v_label, &extmac);
+		if (error)
+			return (error);
+		error = vn_extattr_set(vp, IO_NODELOCKED,
+		    FREEBSD_MAC_EXTATTR_NAMESPACE, FREEBSD_MAC_EXTATTR_NAME,
+		    sizeof(extmac), (char *)&extmac, curthread);
+		if (error == 0)
+			break;
 	default:
 		/* Fail horribly. */
 		return (error);
@@ -987,8 +996,7 @@
 		 * about doing this.
 		 */
 		mac_update_vnode_from_mount(vp, vp->v_mount);
-
-		return (0);
+		error = 0;
 	default:
 		return (error);
 	}
@@ -2216,16 +2224,6 @@
 	    child, &child->v_label);
 }
 
-void
-mac_create_vnode_from_exported(struct ucred *cred, struct vnode *vp,
-    struct mac *extmac, struct label *intlabel)
-{
-	
-	ASSERT_VOP_LOCKED(vp, "mac_create_vnode_from_exported");
-
-	MAC_PERFORM(create_vnode_from_exported, cred, vp, extmac, intlabel);
-}
-
 int
 mac_cred_check_statfs(struct ucred *cred, struct mount *mount)
 {

==== //depot/projects/trustedbsd/mac/sys/sys/mac.h#109 (text+ko) ====

@@ -326,8 +326,6 @@
 	    struct ucred *cred_child);
 void	mac_create_vnode_from_vnode(struct ucred *cred, struct vnode *parent,
 	    struct vnode *child);
-void	mac_create_vnode_from_exported(struct ucred *cred, struct vnode *vp,
-	    struct mac *extmac, struct label *intlabel);
 void	mac_set_socket_peer_from_mbuf(struct mbuf *mbuf,
 	    struct socket *socket);
 void	mac_set_socket_peer_from_socket(struct socket *oldsocket,

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207101502.g6AF2GVj077852>