Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha/alpha Handle EINVAL in fault path, so mmap() ...
details: https://anonhg.NetBSD.org/src/rev/7bd18aa05961
branches: trunk
changeset: 336450:7bd18aa05961
user: martin <martin%NetBSD.org@localhost>
date: Mon Mar 02 11:07:16 2015 +0000
description:
Handle EINVAL in fault path, so mmap() access past EOF gets SIGBUS.
diffstat:
sys/arch/alpha/alpha/trap.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diffs (51 lines):
diff -r 861751230f7e -r 7bd18aa05961 sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c Mon Mar 02 11:05:12 2015 +0000
+++ b/sys/arch/alpha/alpha/trap.c Mon Mar 02 11:07:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.131 2014/05/16 06:11:21 martin Exp $ */
+/* $NetBSD: trap.c,v 1.132 2015/03/02 11:07:16 martin Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.131 2014/05/16 06:11:21 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.132 2015/03/02 11:07:16 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -496,19 +496,28 @@
KSI_INIT_TRAP(&ksi);
ksi.ksi_addr = (void *)a0;
ksi.ksi_trap = a1; /* MMCSR VALUE */
- if (rv == ENOMEM) {
+ switch (rv) {
+ case ENOMEM:
printf("UVM: pid %d (%s), uid %d killed: "
"out of swap\n", l->l_proc->p_pid,
l->l_proc->p_comm,
l->l_cred ?
kauth_cred_geteuid(l->l_cred) : -1);
ksi.ksi_signo = SIGKILL;
- } else
+ break;
+ case EINVAL:
+ ksi.ksi_signo = SIGBUS;
+ ksi.ksi_code = BUS_ADRERR;
+ break;
+ case EACCES:
ksi.ksi_signo = SIGSEGV;
- if (rv == EACCES)
ksi.ksi_code = SEGV_ACCERR;
- else
+ break;
+ default:
+ ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = SEGV_MAPERR;
+ break;
+ }
break;
}
Home |
Main Index |
Thread Index |
Old Index