From owner-p4-projects@FreeBSD.ORG Wed Sep 21 11:21:40 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C769E16A421; Wed, 21 Sep 2005 11:21:39 +0000 (GMT) X-Original-To: perforce@freebsd.org 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 875B116A420 for ; Wed, 21 Sep 2005 11:21:39 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4081E43D58 for ; Wed, 21 Sep 2005 11:21:38 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j8LBLcV0041879 for ; Wed, 21 Sep 2005 11:21:38 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j8LBLbYc041876 for perforce@freebsd.org; Wed, 21 Sep 2005 11:21:37 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 21 Sep 2005 11:21:37 GMT Message-Id: <200509211121.j8LBLbYc041876@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 84048 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 11:21:40 -0000 http://perforce.freebsd.org/chv.cgi?CH=84048 Change 84048 by rwatson@rwatson_zoo on 2005/09/21 11:20:54 When canonicalizing a path, rather than asserting Giant, conditionally acquire it around VFS operations if needed. Affected files ... .. //depot/projects/trustedbsd/audit3/sys/security/audit/kern_bsm_klib.c#10 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/security/audit/kern_bsm_klib.c#10 (text+ko) ==== @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -400,16 +401,16 @@ * written to the audit log. So we will leave the filename starting * with '/' in the audit log in this case. */ -void canon_path(struct thread *td, char *path, char *cpath) +void +canon_path(struct thread *td, char *path, char *cpath) { char *bufp; char *retbuf, *freebuf; int len; struct vnode *vnp; struct filedesc *fdp; + int vfslocked; - mtx_assert(&Giant, MA_OWNED); - fdp = td->td_proc->p_fd; bufp = path; FILEDESC_LOCK(fdp); @@ -444,6 +445,7 @@ * string bounding here seems a bit questionable and * will also require attention. */ + vfslocked = VFS_LOCK_GIANT(vnp->v_mount); vn_lock(vnp, LK_EXCLUSIVE | LK_RETRY, td); if (vn_fullpath(td, vnp, &retbuf, &freebuf) == 0) { /* Copy and free buffer allocated by vn_fullpath() */ @@ -454,6 +456,7 @@ cpath[0] = '\0'; } vput(vnp); + VFS_UNLOCK_GIANT(vfslocked); len = strlen(cpath); strncpy(cpath + len-1, bufp, MAXPATHLEN - len); } else {