Module Name: src
Committed By: riz
Date: Tue Jun 12 23:17:58 UTC 2012
Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5-0]: machdep.c netbsd32_machdep.c
Log Message:
Pull up following revision(s) (requested by spz in ticket #1773):
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.102.4.10.2.1 -r1.102.4.10.2.2 \
src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.55.6.2 -r1.55.6.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/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.102.4.10.2.1 src/sys/arch/amd64/amd64/machdep.c:1.102.4.10.2.2
--- src/sys/arch/amd64/amd64/machdep.c:1.102.4.10.2.1 Fri Apr 23 04:17:29 2010
+++ src/sys/arch/amd64/amd64/machdep.c Tue Jun 12 23:17:57 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.102.4.10.2.1 2010/04/23 04:17:29 snj Exp $ */
+/* $NetBSD: machdep.c,v 1.102.4.10.2.2 2012/06/12 23:17:57 riz Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008
@@ -112,7 +112,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.102.4.10.2.1 2010/04/23 04:17:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.102.4.10.2.2 2012/06/12 23:17:57 riz Exp $");
/* #define XENDEBUG_LOW */
@@ -628,6 +628,16 @@ sendsig(const ksiginfo_t *ksi, const sig
/* 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.55.6.2 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.6.3
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.6.2 Tue Sep 7 19:38:44 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 23:17:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.55.6.2 2010/09/07 19:38:44 bouyer Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.55.6.3 2012/06/12 23:17:58 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.55.6.2 2010/09/07 19:38:44 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.55.6.3 2012/06/12 23:17:58 riz Exp $");
#include "opt_compat_netbsd.h"
#include "opt_coredump.h"
@@ -275,6 +275,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
@@ -360,6 +370,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