rfork(RFPROC|RFMEM)

Igor Sysoev is at rambler-co.ru
Wed May 7 01:15:27 PDT 2003


On Tue, 6 May 2003, John Baldwin wrote:

> On 06-May-2003 Igor Sysoev wrote:
> > On Mon, 5 May 2003, Terry Lambert wrote:
> > 
> >> Igor Sysoev wrote:

> >> > 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?

Yes, you are right. My patch does not restore %esi but set it to 0.
It seems that my code that I used to test the patch does not depend on %esi
in an error case.


Igor Sysoev
http://sysoev.ru/en/



More information about the freebsd-arch mailing list