From owner-freebsd-current Thu Jan 31 10:48:35 2002 Delivered-To: freebsd-current@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id 3A09E37B402 for ; Thu, 31 Jan 2002 10:48:32 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id 0896410DDFE; Thu, 31 Jan 2002 10:48:32 -0800 (PST) Date: Thu, 31 Jan 2002 10:48:32 -0800 From: Alfred Perlstein To: Bruce Evans Cc: current@freebsd.org Subject: Re: lock reversal in fdalloc() Message-ID: <20020131104831.E18604@elvis.mu.org> References: <20020201043751.O5590-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020201043751.O5590-100000@gamplex.bde.org>; from bde@zeta.org.au on Fri, Feb 01, 2002 at 04:43:39AM +1100 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Bruce Evans [020131 09:42] wrote: > Jan 31 18:27:29 gamplex kernel: lock order reversal > Jan 31 18:27:29 gamplex kernel: 1st 0xc26ea034 filedesc structure @ ./@/kern/kern_descrip.c:925 > Jan 31 18:27:29 gamplex kernel: 2nd 0xc031eca0 Giant @ ./@/kern/kern_descrip.c:959 > > %%% > Index: kern_descrip.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v > retrieving revision 1.122 > diff -u -2 -r1.122 kern_descrip.c > --- kern_descrip.c 29 Jan 2002 22:54:19 -0000 1.122 > +++ kern_descrip.c 31 Jan 2002 07:32:43 -0000 > @@ -957,7 +967,9 @@ > fdexpand++; > if (oldofile != NULL) { > + FILEDESC_UNLOCK(fdp); > mtx_lock(&Giant); > FREE(oldofile, M_FILEDESC); > mtx_unlock(&Giant); > + FILEDESC_LOCK(fdp); > } > } > %%% > > I'm not sure that releasing the lock here is safe, but other parts of > fdalloc() do this. I don't think this is safe at a glance, I think it's only safe right before return'ing from the function. I'll look at it later tonight. -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message