Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/vax/vax Handle EINVAL in the fault path and send SI...



details:   https://anonhg.NetBSD.org/src/rev/0463b1e32e7f
branches:  trunk
changeset: 336489:0463b1e32e7f
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Mar 03 13:23:48 2015 +0000

description:
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF

diffstat:

 sys/arch/vax/vax/trap.c |  24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diffs (52 lines):

diff -r 219c193825fb -r 0463b1e32e7f sys/arch/vax/vax/trap.c
--- a/sys/arch/vax/vax/trap.c   Tue Mar 03 11:06:47 2015 +0000
+++ b/sys/arch/vax/vax/trap.c   Tue Mar 03 13:23:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.132 2013/10/25 16:30:52 martin Exp $     */
+/*     $NetBSD: trap.c,v 1.133 2015/03/03 13:23:48 martin Exp $     */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -33,7 +33,7 @@
  /* All bugs are subject to removal without further notice */
                
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.132 2013/10/25 16:30:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.133 2015/03/03 13:23:48 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -244,18 +244,28 @@
                                panic("SEGV in kernel mode: pc %#lx addr %#lx",
                                    tf->tf_pc, tf->tf_code);
                        }
-                       code = SEGV_ACCERR;
-                       if (rv == ENOMEM) {
+                       switch (rv) {
+                       case ENOMEM:
                                printf("UVM: pid %d (%s), uid %d killed: "
                                       "out of swap\n",
                                       p->p_pid, p->p_comm,
                                       l->l_cred ?
                                       kauth_cred_geteuid(l->l_cred) : -1);
                                sig = SIGKILL;
-                       } else {
+                               code = SI_NOINFO;
+                               break;
+                       case EINVAL:
+                               code = BUS_ADRERR;
+                               sig = SIGBUS;
+                               break;
+                       case EACCES:
+                               code = SEGV_ACCERR;
                                sig = SIGSEGV;
-                               if (rv != EACCES)
-                                       code = SEGV_MAPERR;
+                               break;
+                       default:
+                               code = SEGV_MAPERR;
+                               sig = SIGSEGV;
+                               break;
                        }
                } else {
                        trapsig = false;



Home | Main Index | Thread Index | Old Index