Module Name: src
Committed By: riz
Date: Tue Jun 12 23:18:13 UTC 2012
Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: 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.13 -r1.102.4.14 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.55.4.3 -r1.55.4.4 \
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.13 src/sys/arch/amd64/amd64/machdep.c:1.102.4.14
--- src/sys/arch/amd64/amd64/machdep.c:1.102.4.13 Thu Apr 22 20:02:48 2010
+++ src/sys/arch/amd64/amd64/machdep.c Tue Jun 12 23:18:13 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.102.4.13 2010/04/22 20:02:48 snj Exp $ */
+/* $NetBSD: machdep.c,v 1.102.4.14 2012/06/12 23:18:13 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.13 2010/04/22 20:02:48 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.102.4.14 2012/06/12 23:18:13 riz Exp $");
/* #define XENDEBUG_LOW */
@@ -634,6 +634,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.4.3 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.4
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.3 Tue Sep 7 19:38:20 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 23:18:13 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.55.4.3 2010/09/07 19:38:20 bouyer Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.55.4.4 2012/06/12 23:18:13 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.4.3 2010/09/07 19:38:20 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.55.4.4 2012/06/12 23:18:13 riz Exp $");
#include "opt_compat_netbsd.h"
#include "opt_coredump.h"
@@ -278,6 +278,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
@@ -366,6 +376,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