Module Name:    src
Committed By:   bouyer
Date:           Sun Oct 18 15:22:38 UTC 2009

Modified Files:
        src/sys/arch/amd64/amd64 [netbsd-4]: netbsd32_machdep.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1363):
        sys/arch/i386/isa/npx.c: revision 1.132 via patch
        sys/arch/amd64/amd64/fpu.c: revision 1.29 via patch
        sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.59 via patch
        sys/arch/amd64/amd64/machdep.c: revision 1.105 via patch
        sys/arch/i386/i386/machdep.c: revision 1.647 via patch
PR port-i386/39299 FPU use in signal handlers is unsafe
Ensure FP state is reset, if FP is used in a signal handler.
Fixes PR kern/39299 for 32bit code.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.2 -r1.30.2.3 \
    src/sys/arch/amd64/amd64/netbsd32_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/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.30.2.2 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.30.2.3
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.30.2.2	Tue Nov 18 22:33:28 2008
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Sun Oct 18 15:22:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.30.2.2 2008/11/18 22:33:28 bouyer Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.30.2.3 2009/10/18 15:22:38 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.30.2.2 2008/11/18 22:33:28 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.30.2.3 2009/10/18 15:22:38 bouyer Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_coredump.h"
@@ -266,6 +266,9 @@
 	struct lwp *l = curlwp;
 	struct proc *p = l->l_proc;
 	struct sigacts *ps = p->p_sigacts;
+	/* Ensure FP state is reset, if FP is used. */
+	l->l_md.md_flags &= ~MDP_USEDFPU;
+
 	int onstack;
 	int sig = ksi->ksi_signo;
 	struct netbsd32_sigframe_siginfo *fp, frame;
@@ -335,6 +338,9 @@
 	tf->tf_rsp = (u_int64_t)fp;
 	tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL);
 
+	/* Ensure FP state is reset, if FP is used. */
+	l->l_md.md_flags &= ~MDP_USEDFPU;
+
 	/* Remember that we're now on the signal stack. */
 	if (onstack)
 		p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK;

Reply via email to