Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc/sparc Handle EINVAL in the fault path, send S...
details: https://anonhg.NetBSD.org/src/rev/1f0090940735
branches: trunk
changeset: 806598:1f0090940735
user: martin <martin%NetBSD.org@localhost>
date: Mon Mar 02 13:53:19 2015 +0000
description:
Handle EINVAL in the fault path, send SIGSEGV on mmap access past EOF.
diffstat:
sys/arch/sparc/sparc/trap.c | 38 ++++++++++++++++++++++++++------------
1 files changed, 26 insertions(+), 12 deletions(-)
diffs (78 lines):
diff -r fe89569e3431 -r 1f0090940735 sys/arch/sparc/sparc/trap.c
--- a/sys/arch/sparc/sparc/trap.c Mon Mar 02 13:51:24 2015 +0000
+++ b/sys/arch/sparc/sparc/trap.c Mon Mar 02 13:53:19 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.191 2013/11/01 06:22:46 mrg Exp $ */
+/* $NetBSD: trap.c,v 1.192 2015/03/02 13:53:19 martin Exp $ */
/*
* Copyright (c) 1996
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.191 2013/11/01 06:22:46 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.192 2015/03/02 13:53:19 martin Exp $");
#include "opt_ddb.h"
#include "opt_compat_svr4.h"
@@ -949,17 +949,24 @@
return;
}
KSI_INIT_TRAP(&ksi);
- 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);
ksi.ksi_signo = SIGKILL;
- ksi.ksi_code = SI_NOINFO;
- } else {
+ break;
+ case EINVAL:
+ ksi.ksi_signo = SIGBUS;
+ ksi.ksi_code = BUS_ADRERR;
+ case EACCES:
ksi.ksi_signo = SIGSEGV;
- ksi.ksi_code = (rv == EACCES
- ? SEGV_ACCERR : SEGV_MAPERR);
+ ksi.ksi_code = SEGV_ACCERR;
+ default:
+ ksi.ksi_signo = SIGSEGV;
+ ksi.ksi_code = SEGV_MAPERR;
+ break;
}
ksi.ksi_trap = type;
ksi.ksi_addr = (void *)v;
@@ -1236,17 +1243,24 @@
return;
}
KSI_INIT_TRAP(&ksi);
- 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);
ksi.ksi_signo = SIGKILL;
- ksi.ksi_code = SI_NOINFO;
- } else {
+ break;
+ case EINVAL:
+ ksi.ksi_signo = SIGBUS;
+ ksi.ksi_code = BUS_ADRERR;
+ case EACCES:
ksi.ksi_signo = SIGSEGV;
- ksi.ksi_code = (rv == EACCES)
- ? SEGV_ACCERR : SEGV_MAPERR;
+ ksi.ksi_code = SEGV_ACCERR;
+ default:
+ ksi.ksi_signo = SIGSEGV;
+ ksi.ksi_code = SEGV_MAPERR;
+ break;
}
ksi.ksi_trap = type;
ksi.ksi_addr = (void *)sfva;
Home |
Main Index |
Thread Index |
Old Index