From owner-p4-projects Tue Apr 23 17:45:50 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 911C637B419; Tue, 23 Apr 2002 17:45:23 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8794337B41F for ; Tue, 23 Apr 2002 17:45:22 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g3O0jMb31640 for perforce@freebsd.org; Tue, 23 Apr 2002 17:45:22 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 23 Apr 2002 17:45:22 -0700 (PDT) Message-Id: <200204240045.g3O0jMb31640@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 10196 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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