Module Name: src
Committed By: riz
Date: Tue Jun 12 23:13:07 UTC 2012
Modified Files:
src/sys/arch/amd64/amd64 [netbsd-6]: machdep.c netbsd32_machdep.c
Log Message:
Pull up following revision(s) (requested by spz in ticket #337):
sys/arch/amd64/amd64/machdep.c: revision 1.184
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.77
If the user process provided a bogus signal handler address, kill it
now instead of trying to jump to the bogus address.
To generate a diff of this commit:
cvs rdiff -u -r1.175.2.5 -r1.175.2.6 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.74.10.1 -r1.74.10.2 \
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/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.175.2.5 src/sys/arch/amd64/amd64/machdep.c:1.175.2.6
--- src/sys/arch/amd64/amd64/machdep.c:1.175.2.5 Mon May 21 15:25:56 2012
+++ src/sys/arch/amd64/amd64/machdep.c Tue Jun 12 23:13:07 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.175.2.5 2012/05/21 15:25:56 riz Exp $ */
+/* $NetBSD: machdep.c,v 1.175.2.6 2012/06/12 23:13:07 riz Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.5 2012/05/21 15:25:56 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.6 2012/06/12 23:13:07 riz Exp $");
/* #define XENDEBUG_LOW */
@@ -718,6 +718,16 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
/* Remember that we're now on the signal stack. */
if (onstack)
l->l_sigstk.ss_flags |= SS_ONSTACK;
+
+ if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS) {
+ /*
+ * process has given an invalid address for the
+ * handler. Stop it, but do not do it before so
+ * we can return the right info to userland (or in core dump)
+ */
+ sigexit(l, SIGILL);
+ /* NOTREACHED */
+ }
}
void
Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.74.10.1 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.74.10.2
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.74.10.1 Mon May 21 15:25:56 2012
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 23:13:07 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.74.10.1 2012/05/21 15:25:56 riz Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.74.10.2 2012/06/12 23:13:07 riz Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.74.10.1 2012/05/21 15:25:56 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.74.10.2 2012/06/12 23:13:07 riz Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -280,6 +280,16 @@ netbsd32_sendsig_sigcontext(const ksigin
/* Remember that we're now on the signal stack. */
if (onstack)
l->l_sigstk.ss_flags |= SS_ONSTACK;
+
+ if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS32) {
+ /*
+ * process has given an invalid address for the
+ * handler. Stop it, but do not do it before so
+ * we can return the right info to userland (or in core dump)
+ */
+ sigexit(l, SIGILL);
+ /* NOTREACHED */
+ }
}
#endif
@@ -368,6 +378,16 @@ netbsd32_sendsig_siginfo(const ksiginfo_
/* Remember that we're now on the signal stack. */
if (onstack)
l->l_sigstk.ss_flags |= SS_ONSTACK;
+
+ if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS32) {
+ /*
+ * process has given an invalid address for the
+ * handler. Stop it, but do not do it before so
+ * we can return the right info to userland (or in core dump)
+ */
+ sigexit(l, SIGILL);
+ /* NOTREACHED */
+ }
}
void