Module Name: src
Committed By: martin
Date: Thu May 21 13:24:38 UTC 2009
Modified Files:
src/sys/arch/sparc64/sparc64: vm_machdep.c
Log Message:
Deja Vu: when preparing the initial trap frame for a new forked lwp,
explicitly clear condition code. Otherwise we might catch a signal
(handlers are inherited from the parent) before we ever return to
userland. The current trapframe is converted into a ucontext and after
the signal handler returns, the lwp stays in userland and directly
uses the ucontext to return to the fork call.
Fixes PR 41302.
To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/sparc64/sparc64/vm_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/sparc64/sparc64/vm_machdep.c
diff -u src/sys/arch/sparc64/sparc64/vm_machdep.c:1.87 src/sys/arch/sparc64/sparc64/vm_machdep.c:1.88
--- src/sys/arch/sparc64/sparc64/vm_machdep.c:1.87 Mon Mar 16 23:11:15 2009
+++ src/sys/arch/sparc64/sparc64/vm_machdep.c Thu May 21 13:24:38 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.87 2009/03/16 23:11:15 dsl Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.88 2009/05/21 13:24:38 martin Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.87 2009/03/16 23:11:15 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.88 2009/05/21 13:24:38 martin Exp $");
#include "opt_multiprocessor.h"
@@ -261,9 +261,14 @@
if (stack != NULL)
tf2->tf_out[6] = (uint64_t)(u_long)stack + stacksize;
- /* Set return values in child mode */
+ /*
+ * Set return values in child mode and clear condition code,
+ * in case we end up running a signal handler before returning
+ * to userland.
+ */
tf2->tf_out[0] = 0;
tf2->tf_out[1] = 1;
+ tf2->tf_tstate &= ~TSTATE_CCR;
/* Construct kernel frame to return to in cpu_switch() */
rp = (struct rwindow *)((u_long)npcb + TOPFRAMEOFF);