Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/amd64 If the user process provided a bogus si...
details: https://anonhg.NetBSD.org/src/rev/28651a3bc9da
branches: trunk
changeset: 779710:28651a3bc9da
user: bouyer <bouyer%NetBSD.org@localhost>
date: Tue Jun 12 22:16:05 2012 +0000
description:
If the user process provided a bogus signal handler address, kill it
now instead of trying to jump to the bogus address.
diffstat:
sys/arch/amd64/amd64/machdep.c | 14 ++++++++++++--
sys/arch/amd64/amd64/netbsd32_machdep.c | 22 ++++++++++++++++++++--
2 files changed, 32 insertions(+), 4 deletions(-)
diffs (85 lines):
diff -r c86eca70c2bf -r 28651a3bc9da sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Tue Jun 12 21:16:17 2012 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Tue Jun 12 22:16:05 2012 +0000
@@ -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 @@
/* 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;
diff -r c86eca70c2bf -r 28651a3bc9da sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 21:16:17 2012 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 22:16:05 2012 +0000
@@ -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 @@
/* 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 @@
/* 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
Home |
Main Index |
Thread Index |
Old Index