Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2002 17:45:22 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 10196 for review
Message-ID:  <200204240045.g3O0jMb31640@freefall.freebsd.org>

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

Change 10196 by rwatson@rwatson_curry on 2002/04/23 17:44:46

	Add vnode locking assertions to MAC hooks that act on vnodes; not
	yet tested, and may hurt due to possible VFS locking issues.  In
	particular, the revoke() MAC hook may assume locking, but the
	revoke VOP_() doesn't.

Affected files ...

... //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#127 edit

Differences ...

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

@@ -962,6 +962,8 @@
 	struct mac oldlabel;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_relabel_vnode");
+
 	if (!mac_label_valid(newlabel))
 		return (EINVAL);
 
@@ -979,6 +981,8 @@
 	struct mac dirlabel;
 	int error;
 
+	ASSERT_VOP_LOCKED(dvp, "mac_cred_check_chdir_vnode");
+
 	error = VOP_GETLABEL(dvp, &dirlabel, cred, curthread);
 	if (error)
 		return (error);
@@ -993,6 +997,8 @@
 	struct mac dirlabel;
 	int error;
 
+	ASSERT_VOP_LOCKED(dvp, "mac_cred_check_create_vnode");
+
 	error = VOP_GETLABEL(dvp, &dirlabel, cred, curthread);
 	if (error)
 		return (error);
@@ -1007,6 +1013,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_getextattr_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1021,6 +1029,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_open_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1034,6 +1044,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_revoke_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1047,6 +1059,8 @@
 	struct mac dirlabel;
 	int error;
 
+	ASSERT_VOP_LOCKED(dvp, "mac_cred_check_search_vnode");
+
 	error = VOP_GETLABEL(dvp, &dirlabel, cred, curthread);
 	if (error)
 		return (error);
@@ -1061,6 +1075,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_setextattr_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1076,6 +1092,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_setflags_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1090,6 +1108,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_setmode_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1104,6 +1124,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_setowner_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1118,6 +1140,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_setutimes_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1132,6 +1156,9 @@
 	struct mac dirlabel, filelabel;
 	int error;
 
+	ASSERT_VOP_LOCKED(dvp, "mac_cred_check_delete_vnode");
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_delete_vnode");
+
 	error = VOP_GETLABEL(dvp, &dirlabel, cred, curthread);
 	if (error)
 		return (error);
@@ -1150,6 +1177,9 @@
 	struct mac dirlabel, filelabel;
 	int error;
 
+	ASSERT_VOP_LOCKED(dvp, "mac_cred_check_rename_from_vnode");
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_rename_from_vnode");
+
 	error = VOP_GETLABEL(dvp, &dirlabel, cred, curthread);
 	if (error)
 		return (error);
@@ -1168,6 +1198,9 @@
 	struct mac dirlabel, filelabel;
 	int error;
 
+	ASSERT_VOP_LOCKED(dvp, "mac_cred_check_rename_to_vnode");
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_rename_to_vnode");
+
 	error = VOP_GETLABEL(dvp, &dirlabel, cred, curthread);
 	if (error)
 		return (error);
@@ -1187,6 +1220,8 @@
 	struct mac label;
 	int error;
 
+	ASSERT_VOP_LOCKED(vp, "mac_cred_check_stat_vnode");
+
 	error = VOP_GETLABEL(vp, &label, cred, curthread);
 	if (error)
 		return (error);
@@ -1480,6 +1515,9 @@
 	struct mac parentlabel;
 	int error;
 
+	ASSERT_VOP_LOCKED(parent, "mac_create_vnode_from_vnode");
+	ASSERT_VOP_LOCKED(child, "mac_create_vnode_from_vnode");
+
 	error = VOP_GETLABEL(parent, &parentlabel, curthread->td_ucred,
 	    curthread);
 	if (error) {

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?200204240045.g3O0jMb31640>