Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Handle EINVAL in the fault path and send SIGBUS on ...
details: https://anonhg.NetBSD.org/src/rev/4d13bf411e37
branches: trunk
changeset: 336525:4d13bf411e37
user: martin <martin%NetBSD.org@localhost>
date: Wed Mar 04 20:29:59 2015 +0000
description:
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF
diffstat:
sys/arch/atari/atari/trap.c | 20 ++++++++++++++++----
sys/arch/cesfic/cesfic/trap.c | 20 ++++++++++++++++----
sys/arch/hp300/hp300/trap.c | 20 ++++++++++++++++----
sys/arch/luna68k/luna68k/trap.c | 20 ++++++++++++++++----
sys/arch/mvme68k/mvme68k/trap.c | 20 ++++++++++++++++----
sys/arch/news68k/news68k/trap.c | 20 ++++++++++++++++----
sys/arch/next68k/next68k/trap.c | 20 ++++++++++++++++----
sys/arch/sun2/sun2/trap.c | 20 ++++++++++++++++----
sys/arch/sun3/sun3/trap.c | 20 ++++++++++++++++----
sys/arch/x68k/x68k/trap.c | 20 ++++++++++++++++----
10 files changed, 160 insertions(+), 40 deletions(-)
diffs (truncated from 470 to 300 lines):
diff -r c6dc9ca14034 -r 4d13bf411e37 sys/arch/atari/atari/trap.c
--- a/sys/arch/atari/atari/trap.c Wed Mar 04 19:56:24 2015 +0000
+++ b/sys/arch/atari/atari/trap.c Wed Mar 04 20:29:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.112 2012/02/19 21:06:05 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.113 2015/03/04 20:29:59 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.112 2012/02/19 21:06:05 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.113 2015/03/04 20:29:59 martin Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -656,14 +656,26 @@
panictrap(type, code, v, fp);
}
ksi.ksi_addr = (void *)v;
- 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;
- } 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;
}
break;
}
diff -r c6dc9ca14034 -r 4d13bf411e37 sys/arch/cesfic/cesfic/trap.c
--- a/sys/arch/cesfic/cesfic/trap.c Wed Mar 04 19:56:24 2015 +0000
+++ b/sys/arch/cesfic/cesfic/trap.c Wed Mar 04 20:29:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.56 2012/02/19 21:06:06 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.57 2015/03/04 20:29:59 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.56 2012/02/19 21:06:06 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.57 2015/03/04 20:29:59 martin Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -610,14 +610,26 @@
goto dopanic;
}
ksi.ksi_addr = (void *)v;
- 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;
- } 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;
}
break;
}
diff -r c6dc9ca14034 -r 4d13bf411e37 sys/arch/hp300/hp300/trap.c
--- a/sys/arch/hp300/hp300/trap.c Wed Mar 04 19:56:24 2015 +0000
+++ b/sys/arch/hp300/hp300/trap.c Wed Mar 04 20:29:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.150 2013/08/16 13:39:47 tsutsui Exp $ */
+/* $NetBSD: trap.c,v 1.151 2015/03/04 20:29:59 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.150 2013/08/16 13:39:47 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.151 2015/03/04 20:29:59 martin Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -632,14 +632,26 @@
goto dopanic;
}
ksi.ksi_addr = (void *)v;
- 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;
- } 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;
}
break;
}
diff -r c6dc9ca14034 -r 4d13bf411e37 sys/arch/luna68k/luna68k/trap.c
--- a/sys/arch/luna68k/luna68k/trap.c Wed Mar 04 19:56:24 2015 +0000
+++ b/sys/arch/luna68k/luna68k/trap.c Wed Mar 04 20:29:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.68 2012/02/19 21:06:13 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.69 2015/03/04 20:29:59 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.68 2012/02/19 21:06:13 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.69 2015/03/04 20:29:59 martin Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -559,14 +559,26 @@
goto dopanic;
}
ksi.ksi_addr = (void *)v;
- 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;
- } 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;
}
break;
}
diff -r c6dc9ca14034 -r 4d13bf411e37 sys/arch/mvme68k/mvme68k/trap.c
--- a/sys/arch/mvme68k/mvme68k/trap.c Wed Mar 04 19:56:24 2015 +0000
+++ b/sys/arch/mvme68k/mvme68k/trap.c Wed Mar 04 20:29:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.107 2014/03/24 19:52:27 christos Exp $ */
+/* $NetBSD: trap.c,v 1.108 2015/03/04 20:29:59 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.107 2014/03/24 19:52:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.108 2015/03/04 20:29:59 martin Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -628,14 +628,26 @@
goto dopanic;
}
ksi.ksi_addr = (void *)v;
- 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;
- } 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;
}
break;
}
diff -r c6dc9ca14034 -r 4d13bf411e37 sys/arch/news68k/news68k/trap.c
--- a/sys/arch/news68k/news68k/trap.c Wed Mar 04 19:56:24 2015 +0000
+++ b/sys/arch/news68k/news68k/trap.c Wed Mar 04 20:29:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.68 2012/02/19 21:06:21 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.69 2015/03/04 20:30:00 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.68 2012/02/19 21:06:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.69 2015/03/04 20:30:00 martin Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -575,14 +575,26 @@
goto dopanic;
}
ksi.ksi_addr = (void *)v;
- 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;
- } 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;
}
break;
}
diff -r c6dc9ca14034 -r 4d13bf411e37 sys/arch/next68k/next68k/trap.c
--- a/sys/arch/next68k/next68k/trap.c Wed Mar 04 19:56:24 2015 +0000
+++ b/sys/arch/next68k/next68k/trap.c Wed Mar 04 20:29:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.87 2014/03/24 20:01:03 christos Exp $ */
+/* $NetBSD: trap.c,v 1.88 2015/03/04 20:30:00 martin Exp $ */
/*
* This file was taken from mvme68k/mvme68k/trap.c
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.87 2014/03/24 20:01:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.88 2015/03/04 20:30:00 martin Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
Home |
Main Index |
Thread Index |
Old Index