Module Name: src
Committed By: bouyer
Date: Tue Jun 12 22:16:05 UTC 2012
Modified Files:
src/sys/arch/amd64/amd64: machdep.c netbsd32_machdep.c
Log Message:
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.183 -r1.184 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.76 -r1.77 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.183 src/sys/arch/amd64/amd64/machdep.c:1.184
--- src/sys/arch/amd64/amd64/machdep.c:1.183 Mon May 21 14:15:17 2012
+++ src/sys/arch/amd64/amd64/machdep.c Tue Jun 12 22:16:05 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.183 2012/05/21 14:15:17 martin Exp $ */
+/* $NetBSD: machdep.c,v 1.184 2012/06/12 22:16:05 bouyer 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.183 2012/05/21 14:15:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.184 2012/06/12 22:16:05 bouyer Exp $");
/* #define XENDEBUG_LOW */
@@ -711,6 +711,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 */
+ }
}
struct pcb dumppcb;
Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.76 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.77
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.76 Mon May 21 14:15:17 2012
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 22:16:05 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.76 2012/05/21 14:15:17 martin Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.77 2012/06/12 22:16:05 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.76 2012/05/21 14:15:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.77 2012/06/12 22:16:05 bouyer Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -278,6 +278,15 @@ 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
@@ -366,6 +375,15 @@ 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