Module Name: src
Committed By: skrll
Date: Wed Mar 4 09:39:26 UTC 2015
Modified Files:
src/sys/arch/sh3/sh3: exception.c
Log Message:
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.
>From martin@
To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c
diff -u src/sys/arch/sh3/sh3/exception.c:1.63 src/sys/arch/sh3/sh3/exception.c:1.64
--- src/sys/arch/sh3/sh3/exception.c:1.63 Sun Jul 8 20:14:12 2012
+++ src/sys/arch/sh3/sh3/exception.c Wed Mar 4 09:39:26 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: exception.c,v 1.63 2012/07/08 20:14:12 dsl Exp $ */
+/* $NetBSD: exception.c,v 1.64 2015/03/04 09:39:26 skrll Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.63 2012/07/08 20:14:12 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.64 2015/03/04 09:39:26 skrll Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -417,11 +417,22 @@ tlb_exception(struct lwp *l, struct trap
/* Page not found. */
if (usermode) {
KSI_INIT_TRAP(&ksi);
- if (err == ENOMEM)
+ switch (err) {
+ case ENOMEM:
ksi.ksi_signo = SIGKILL;
- else {
+ break;
+ case EINVAL:
+ ksi.ksi_signo = SIGBUS;
+ ksi.ksi_code = BUS_ADRERR;
+ break;
+ case EACCES:
+ ksi.ksi_signo = SIGSEGV;
+ ksi.ksi_code = SEGV_ACCERR;
+ break;
+ default:
ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = SEGV_MAPERR;
+ break;
}
goto user_fault;
} else {