From owner-freebsd-arch@FreeBSD.ORG Tue May 6 13:12:13 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75AD237B404 for ; Tue, 6 May 2003 13:12:13 -0700 (PDT) Received: from mail.speakeasy.net (mail15.speakeasy.net [216.254.0.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7999443F75 for ; Tue, 6 May 2003 13:12:12 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 4701 invoked from network); 6 May 2003 20:12:18 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 6 May 2003 20:12:18 -0000 Received: from laptop.baldwin.cx ([216.133.140.1]) by server.baldwin.cx (8.12.8/8.12.8) with ESMTP id h46KC8p0001371; Tue, 6 May 2003 16:12:10 -0400 (EDT) (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: Date: Tue, 06 May 2003 16:12:15 -0400 (EDT) From: John Baldwin To: Igor Sysoev cc: peter@FreeBSD.org cc: freebsd-arch@freebsd.org Subject: Re: rfork(RFPROC|RFMEM) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2003 20:12:13 -0000 On 06-May-2003 Igor Sysoev wrote: > On Mon, 5 May 2003, Terry Lambert wrote: > >> Igor Sysoev wrote: >> > On Mon, 5 May 2003, Terry Lambert wrote: >> > What is stack glue ? >> >> See the code in fork1() in /sys/kern/kern_fork.c. > > I do not see any stack manipulation in kern_fork.c except the creating > alternate kstack for KSE thread in 5.0. And rfork(2) can not create > such stack - it passes 0 to fork1(). > In 4.x there's no stack code at all. > >> > I use rfork_thread(3) wrapper that allows to setup another stack for >> > rfork()ed process. > > By the way I found the bug in x86 rfork_thread(3)'s error handling: > > --- /usr/src/lib/libc/i386/gen/rfork_thread.S Wed Feb 7 03:12:45 2001 > +++ /usr/src/lib/libc/i386/gen/rfork_thread.S Tue May 6 17:45:14 2003 > @@ -108,5 +108,8 @@ > * Branch here if the thread creation fails: > */ > 2: > + popl %esi > + movl %ebp, %esp > + popl %ebp > PIC_PROLOGUE > jmp PIC_PLT(HIDENAME(cerror)) Shouldn't this be: 2: + addl $8, %esp + popl %esi + movl %ebp, %esp + popl %ebp PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) To match the parent return case above the 1: label? -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/