Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: powerpc/powerpc/vm_machdep.c:cpu_fork(): tf used uninitialized



Tad Hunt <tad%entrisphere.com@localhost> writes:

> ``tf'' will be used uninitialized in cpu_fork(), (if ``stack != NULL'').
> 
> I haven't looked at how cpu_fork() is used, so I can't provide a bugfix.
> I currently panic() if stack != NULL until I figure out what is supposed
> to happen.

The only place where fork1(), and hence cpu_fork(), is passed a
non-NULL stack is in the emulation of the Linux clone() system call. 

It looks like a reasonable (though untested) fix to vm_machdep.c would be:

*** vm_machdep.c        2001/03/22 04:11:46     1.24
--- vm_machdep.c        2001/03/31 06:56:15
***************
*** 112,118 ****
         * Setup the trap frame for the new process
         */
        stktop1 = (caddr_t)trapframe(p1);
!       stktop2 = (caddr_t)trapframe(p2);
        bcopy(stktop1, stktop2, sizeof(struct trapframe));
  
        /*
--- 112,119 ----
         * Setup the trap frame for the new process
         */
        stktop1 = (caddr_t)trapframe(p1);
!       tf = trapframe(p2);
!       stktop2 = (caddr_t)tf;
        bcopy(stktop1, stktop2, sizeof(struct trapframe));
  
        /*

        - Nathan



Home | Main Index | Thread Index | Old Index