Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/amd64 Attempt to clarify panic messages for n...
details: https://anonhg.NetBSD.org/src/rev/1110c65137e3
branches: trunk
changeset: 357992:1110c65137e3
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Dec 07 03:25:51 2017 +0000
description:
Attempt to clarify panic messages for null pointer access/execute.
diffstat:
sys/arch/amd64/amd64/trap.c | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diffs (50 lines):
diff -r f0f039d03cd2 -r 1110c65137e3 sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c Thu Dec 07 03:16:24 2017 +0000
+++ b/sys/arch/amd64/amd64/trap.c Thu Dec 07 03:25:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.105 2017/12/02 12:40:03 maxv Exp $ */
+/* $NetBSD: trap.c,v 1.106 2017/12/07 03:25:51 riastradh Exp $ */
/*
* Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.105 2017/12/02 12:40:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.106 2017/12/07 03:25:51 riastradh Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -518,16 +518,26 @@
if (frame->tf_err & PGEX_X) {
/* SMEP might have brought us here */
- if (cr2 < VM_MAXUSER_ADDRESS)
- panic("prevented execution of %p (SMEP)",
- (void *)cr2);
+ if (cr2 < VM_MAXUSER_ADDRESS) {
+ if (cr2 == 0)
+ panic("prevented jump to null"
+ " instruction pointer (SMEP)");
+ else
+ panic("prevented execution of"
+ " user address %p (SMEP)",
+ (void *)cr2);
+ }
}
if (cr2 < VM_MAXUSER_ADDRESS) {
/* SMAP might have brought us here */
- if (onfault_handler(pcb, frame) == NULL)
- panic("prevented access to %p (SMAP)",
+ if (onfault_handler(pcb, frame) == NULL) {
+ panic("prevented %s %p (SMAP)",
+ (cr2 < PAGE_SIZE
+ ? "null pointer dereference at"
+ : "access to"),
(void *)cr2);
+ }
}
goto faultcommon;
Home |
Main Index |
Thread Index |
Old Index