Module Name:    src
Committed By:   martin
Date:           Tue Mar  3 13:23:49 UTC 2015

Modified Files:
        src/sys/arch/vax/vax: trap.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/vax/vax/trap.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/vax/vax/trap.c
diff -u src/sys/arch/vax/vax/trap.c:1.132 src/sys/arch/vax/vax/trap.c:1.133
--- src/sys/arch/vax/vax/trap.c:1.132	Fri Oct 25 16:30:52 2013
+++ src/sys/arch/vax/vax/trap.c	Tue Mar  3 13:23:48 2015
@@ -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 @@ if(faultdebug)printf("trap accflt type %
 				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;

Reply via email to