Module Name: src
Committed By: riz
Date: Tue Jun 12 23:21:42 UTC 2012
Modified Files:
src/sys/arch/amd64/amd64 [netbsd-4-0]: machdep.c netbsd32_machdep.c
Log Message:
Pull up following revision(s) (requested by spz in ticket #1450):
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.44.2.3 -r1.44.2.3.6.1 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.30.2.1 -r1.30.2.1.6.1 \
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.44.2.3 src/sys/arch/amd64/amd64/machdep.c:1.44.2.3.6.1
--- src/sys/arch/amd64/amd64/machdep.c:1.44.2.3 Fri Apr 20 20:31:25 2007
+++ src/sys/arch/amd64/amd64/machdep.c Tue Jun 12 23:21:42 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.44.2.3 2007/04/20 20:31:25 bouyer Exp $ */
+/* $NetBSD: machdep.c,v 1.44.2.3.6.1 2012/06/12 23:21:42 riz Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.44.2.3 2007/04/20 20:31:25 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.44.2.3.6.1 2012/06/12 23:21:42 riz Exp $");
#include "opt_user_ldt.h"
#include "opt_ddb.h"
@@ -522,6 +522,16 @@ sendsig(const ksiginfo_t *ksi, const sig
/* Remember that we're now on the signal stack. */
if (onstack)
p->p_sigctx.ps_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.30.2.1 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.30.2.1.6.1
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.30.2.1 Sat Jan 6 13:18:16 2007
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 23:21:42 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.30.2.1 2007/01/06 13:18:16 bouyer Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.30.2.1.6.1 2012/06/12 23:21:42 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.30.2.1 2007/01/06 13:18:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.30.2.1.6.1 2012/06/12 23:21:42 riz Exp $");
#include "opt_compat_netbsd.h"
#include "opt_coredump.h"
@@ -256,6 +256,16 @@ netbsd32_sendsig_sigcontext(const ksigin
/* Remember that we're now on the signal stack. */
if (onstack)
p->p_sigctx.ps_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 */
+ }
}
#endif
@@ -337,6 +347,16 @@ netbsd32_sendsig_siginfo(const ksiginfo_
/* Remember that we're now on the signal stack. */
if (onstack)
p->p_sigctx.ps_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