From 252cc8f6b2a2fac727d575244a1224d36e1e2563 Mon Sep 17 00:00:00 2001 From: Thomas Moestl Date: Tue, 23 Mar 2004 23:12:02 +0000 Subject: [PATCH] Intitialize the frame pointer and return pc of a new process created in cpu_fork(). This prevents the stack tracer from running past the end of the stack (only the pc is checked in that case), which became fatal when db_print_backtrace() was introduced and called outside of ddb. Additional testing: kris --- sys/sparc64/sparc64/vm_machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c index 4ef0ed92530..cb21b7311c5 100644 --- a/sys/sparc64/sparc64/vm_machdep.c +++ b/sys/sparc64/sparc64/vm_machdep.c @@ -300,6 +300,8 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) fp->fr_local[0] = (u_long)fork_return; fp->fr_local[1] = (u_long)td2; fp->fr_local[2] = (u_long)tf; + /* Terminate stack traces at this frame. */ + fp->fr_pc = fp->fr_fp = 0; pcb2->pcb_sp = (u_long)fp - SPOFF; pcb2->pcb_pc = (u_long)fork_trampoline - 8;