Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 May 2003 16:12:15 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Igor Sysoev <is@rambler-co.ru>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: rfork(RFPROC|RFMEM)
Message-ID:  <XFMail.20030506161215.jhb@FreeBSD.org>
In-Reply-To: <Pine.BSF.4.21.0305061751340.64470-100000@is>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030506161215.jhb>