From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 4 11:35:07 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5451F16A4CF for ; Tue, 4 Nov 2003 11:35:07 -0800 (PST) Received: from mail.speakeasy.net (mail7.speakeasy.net [216.254.0.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 128C843FCB for ; Tue, 4 Nov 2003 11:35:02 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 25950 invoked from network); 4 Nov 2003 19:35:01 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 4 Nov 2003 19:35:01 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id hA4JYbce070696; Tue, 4 Nov 2003 14:34:37 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20031104191526.GA79079@VARK.homeunix.com> From: John Baldwin To: David Schultz X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: FreeBSD Hackers cc: FreeBSD Bugs cc: Igor Serikov Subject: Re: rfork problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 04 Nov 2003 19:35:07 -0000 X-Original-Date: Tue, 04 Nov 2003 14:34:37 -0500 (EST) X-List-Received-Date: Tue, 04 Nov 2003 19:35:07 -0000 On 04-Nov-2003 David Schultz wrote: > On Tue, Nov 04, 2003, Igor Serikov wrote: >> >> David, >> >> Is it okay to have a condition that can be created by a mortal user and >> then cannot be changed by the root? The waiting process cannot be killed >> and would keep "waiting" till system reboot. > > Aah, I see. No, it's not okay that a non-root user can create an > unkillable process. -CURRENT doesn't have this problem because it > rightly fails when a userland program tries to use RFPPWAIT. (It > isn't supposed to be available to userland, which is why it isn't > documented.) The problem could be fixed by backporting the > relevant bits from -CURRENT. > >> I do not think it is a good idea to make ppwait state uninterruptible in >> any case. > > I do not think it would be safe to deliver a signal to a parent > process while a vforked child is borrowing its address space. > > Here's a patch against -STABLE: > > Index: kern_fork.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_fork.c,v > retrieving revision 1.72.2.15 > diff -u -r1.72.2.15 kern_fork.c > --- kern_fork.c 28 Sep 2003 11:08:31 -0000 1.72.2.15 > +++ kern_fork.c 4 Nov 2003 19:13:33 -0000 > @@ -130,6 +130,9 @@ > int error; > struct proc *p2; > > + /* Don't allow kernel only flags. */ > + if ((uap->flags & RFKERNELONLY) != 0) > + return (EINVAL); > error = fork1(p, uap->flags, &p2); > if (error == 0) { > p->p_retval[0] = p2 ? p2->p_pid : 0; You'll need to backport RFKERNELONLY as well in sys/unistd.h as that isn't in 4.x AFAIK. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/