From owner-freebsd-current Mon Apr 22 13:18:34 2002 Delivered-To: freebsd-current@freebsd.org Received: from gw.nectar.cc (gw.nectar.cc [208.42.49.153]) by hub.freebsd.org (Postfix) with ESMTP id 9098637B416; Mon, 22 Apr 2002 13:18:26 -0700 (PDT) Received: from madman.nectar.cc (madman.nectar.cc [10.0.1.111]) by gw.nectar.cc (Postfix) with ESMTP id A426D36; Mon, 22 Apr 2002 07:02:55 -0500 (CDT) Received: from madman.nectar.cc (localhost [IPv6:::1]) by madman.nectar.cc (8.12.2/8.11.6) with ESMTP id g3MC2tVw068492; Mon, 22 Apr 2002 07:02:55 -0500 (CDT) (envelope-from nectar@madman.nectar.cc) Received: (from nectar@localhost) by madman.nectar.cc (8.12.2/8.12.2/Submit) id g3MC2mh4068491; Mon, 22 Apr 2002 07:02:48 -0500 (CDT) Date: Mon, 22 Apr 2002 07:02:48 -0500 From: "Jacques A. Vidrine" To: Bruce Evans Cc: alfred@FreeBSD.org, phk@FreeBSD.org, Maxim Konovalov , freebsd-current@FreeBSD.org, Adrian Penisoara Subject: Re: panic:bremfree with today's current and linux-netscape Message-ID: <20020422120247.GD68403@madman.nectar.cc> Mail-Followup-To: "Jacques A. Vidrine" , Bruce Evans , alfred@FreeBSD.org, phk@FreeBSD.org, Maxim Konovalov , freebsd-current@FreeBSD.ORG, Adrian Penisoara References: <20020421210807.T76833-100000@news1.macomnet.ru> <20020422181848.G8032-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020422181848.G8032-100000@gamplex.bde.org> User-Agent: Mutt/1.3.28i X-Url: http://www.nectar.cc/ 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 On Mon, Apr 22, 2002 at 06:25:17PM +1000, Bruce Evans wrote: > On Sun, 21 Apr 2002, Maxim Konovalov wrote: > > > As Adrian Penisoara already reported > > > > http://docs.freebsd.org/cgi/getmsg.cgi?fetch=19645+0+current/freebsd-current > > > > there is panic in -current. I believe it is related to the next > > commit: > > > > nectar 2002/04/18 17:45:29 PDT > > > > Modified files: > > sys/kern kern_descrip.c kern_exec.c > > sys/sys filedesc.h > > Log: > > When exec'ing a set[ug]id program, make sure that the stdio file descriptors > > (0, 1, 2) are allocated by opening /dev/null for any which are not already > > open. > > > > Reviewed by: alfred, phk > > MFC after: 2 days > > > > Here is my workaround but I am not sure is it correct or not. Seems > > falloc() takes care about locking itself. > > > > Index: src/sys/kern/kern_descrip.c > > =================================================================== > > RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v > > retrieving revision 1.138 > > diff -u -r1.138 kern_descrip.c > > --- src/sys/kern/kern_descrip.c 20 Apr 2002 12:02:52 -0000 1.138 > > +++ src/sys/kern/kern_descrip.c 21 Apr 2002 17:04:58 -0000 > > @@ -1528,9 +1528,7 @@ > > if (fdp->fd_ofiles[i] != NULL) > > continue; > > if (devnull < 0) { > > - FILEDESC_LOCK(fdp); > > error = falloc(td, &fp, &fd); > > - FILEDESC_UNLOCK(fdp); > > if (error != 0) > > break; > > NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/null", > > > > %%% > > I use the same patch. Locking here is essentially equivalent to calling > panic() here (except it gives a more confusing panic message :-). :-) That's a bit of an overstatement; my testing didn't catch it. I do see that falloc does lock the file descriptor table too, though --- I wonder how it ever worked. Bouncing to the previous reviewers to make sure that this is the correct fix. Comments alfred, phk? Oh, especially Alfred --- it seems you committed the delta that added locking to the file descriptor table. Meanwhile I'll see if I can reproduce. I wonder if interaction with the linuxlator is required to tickle the bug. > I think opening file descriptors on exec is wrong anyway. POSIX has > close-on-exec but not open-on-exec. Cheers, -- Jacques A. Vidrine http://www.nectar.cc/ NTT/Verio SME . FreeBSD UNIX . Heimdal Kerberos jvidrine@verio.net . nectar@FreeBSD.org . nectar@kth.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message