Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/e4abd4d9165a
branches:  trunk
changeset: 336505:e4abd4d9165a
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Mar 04 09:39:26 2015 +0000

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

>From martin@

diffstat:

 sys/arch/sh3/sh3/exception.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r da6ebd58cf44 -r e4abd4d9165a sys/arch/sh3/sh3/exception.c
--- a/sys/arch/sh3/sh3/exception.c      Wed Mar 04 05:35:50 2015 +0000
+++ b/sys/arch/sh3/sh3/exception.c      Wed Mar 04 09:39:26 2015 +0000
@@ -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 @@
        /* 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 {



Home | Main Index | Thread Index | Old Index