Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/mips Fixup siginfo



details:   https://anonhg.NetBSD.org/src/rev/88b2144d067c
branches:  trunk
changeset: 347666:88b2144d067c
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Sep 10 13:40:14 2016 +0000

description:
Fixup siginfo

diffstat:

 sys/arch/mips/mips/trap.c |  39 +++++++++++++++++++++++----------------
 1 files changed, 23 insertions(+), 16 deletions(-)

diffs (61 lines):

diff -r be57caff0692 -r 88b2144d067c sys/arch/mips/mips/trap.c
--- a/sys/arch/mips/mips/trap.c Sat Sep 10 13:16:12 2016 +0000
+++ b/sys/arch/mips/mips/trap.c Sat Sep 10 13:40:14 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.241 2016/07/11 18:54:32 skrll Exp $ */
+/*     $NetBSD: trap.c,v 1.242 2016/09/10 13:40:14 skrll Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.241 2016/07/11 18:54:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.242 2016/09/10 13:40:14 skrll Exp $");
 
 #include "opt_cputype.h"       /* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -433,21 +433,28 @@
                }
                if ((type & T_USER) == 0)
                        goto copyfault;
-               if (rv == 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) : (uid_t) -1);
+
+               KSI_INIT_TRAP(&ksi);
+               switch (rv) {
+               case EINVAL:
+                       ksi.ksi_signo = SIGBUS;
+                       ksi.ksi_code = BUS_ADRERR;
+                       break;
+               case EACCES:
+                       ksi.ksi_signo = SIGSEGV;
+                       ksi.ksi_code = SEGV_ACCERR;
+                       rv = EFAULT;
+                       break;
+               case ENOMEM:
                        ksi.ksi_signo = SIGKILL;
-                       ksi.ksi_code = 0;
-               } else {
-                       if (rv == EACCES) {
-                               ksi.ksi_signo = SIGBUS;
-                               ksi.ksi_code = BUS_OBJERR;
-                       } else {
-                               ksi.ksi_signo = SIGSEGV;
-                               ksi.ksi_code = SEGV_MAPERR;
-                       }
+                       printf("UVM: pid %d.%d (%s), uid %d killed: "
+                           "out of swap\n", p->p_pid, l->l_lid, p->p_comm,
+                           l->l_cred ? kauth_cred_geteuid(l->l_cred) : -1);
+                       break;
+               default:
+                       ksi.ksi_signo = SIGSEGV;
+                       ksi.ksi_code = SEGV_MAPERR;
+                       break;
                }
                ksi.ksi_trap = type & ~T_USER;
                ksi.ksi_addr = (void *)vaddr;



Home | Main Index | Thread Index | Old Index