Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/arch/amd64/amd64 Pull up following revision(s) (reque...



details:   https://anonhg.NetBSD.org/src/rev/2feef3e6fcea
branches:  netbsd-6
changeset: 774211:2feef3e6fcea
user:      riz <riz%NetBSD.org@localhost>
date:      Tue Jun 12 23:13:07 2012 +0000

description:
Pull up following revision(s) (requested by spz in ticket #337):
        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.

diffstat:

 sys/arch/amd64/amd64/machdep.c          |  14 ++++++++++++--
 sys/arch/amd64/amd64/netbsd32_machdep.c |  24 ++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 4 deletions(-)

diffs (87 lines):

diff -r 0e1c85927529 -r 2feef3e6fcea sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Tue Jun 12 22:07:07 2012 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Tue Jun 12 23:13:07 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.175.2.5 2012/05/21 15:25:56 riz Exp $    */
+/*     $NetBSD: machdep.c,v 1.175.2.6 2012/06/12 23:13:07 riz 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.175.2.5 2012/05/21 15:25:56 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.6 2012/06/12 23:13:07 riz Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -718,6 +718,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 */
+       }
 }
 
 void 
diff -r 0e1c85927529 -r 2feef3e6fcea sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Tue Jun 12 22:07:07 2012 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Tue Jun 12 23:13:07 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.74.10.1 2012/05/21 15:25:56 riz Exp $   */
+/*     $NetBSD: netbsd32_machdep.c,v 1.74.10.2 2012/06/12 23:13:07 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.74.10.1 2012/05/21 15:25:56 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.74.10.2 2012/06/12 23:13:07 riz Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -280,6 +280,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_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
 
@@ -368,6 +378,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_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