summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-12-23 19:28:15 +0000
committerjhb <jhb@FreeBSD.org>2016-12-23 19:28:15 +0000
commitc566331351e10a5525edd4e523bda0d160768d14 (patch)
tree2a624f7f0b7b3ee09f58348a1994f93cac7a2d57 /sys/i386
parentf69f62bc7b78f054e04361614b5abf9a4445758a (diff)
downloadFreeBSD-src-c566331351e10a5525edd4e523bda0d160768d14.zip
FreeBSD-src-c566331351e10a5525edd4e523bda0d160768d14.tar.gz
MFC 308820,308821: Fixes for fatal page faults on x86.
308820: Report page faults due to reserved bits in PTEs as a separate fault type. Rather than reporting a page fault due to a bad PTE as a protection violation with the "rsv" flag, treat these faults as a separate type of fault altogether. 308821: MFamd64: Various fatal page fault fixes. - If a page fault is triggered due to reserved bits in a PTE, treat it as a fatal fault and panic. - If PG_NX is in use, report whether a fatal page fault is due to an instruction fetch or a data access. - If a fatal page fault is due to reserved bits in a PTE, report that as the page fault type rather than a protection violation.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/trap.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index 3cf0c5a..2ab8d1b 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -857,6 +857,14 @@ trap_pfault(frame, usermode, eva)
}
/*
+ * If the trap was caused by errant bits in the PTE then panic.
+ */
+ if (frame->tf_err & PGEX_RSV) {
+ trap_fatal(frame, eva);
+ return (-1);
+ }
+
+ /*
* PGEX_I is defined only if the execute disable bit capability is
* supported and enabled.
*/
@@ -926,9 +934,15 @@ trap_fatal(frame, eva)
#endif
if (type == T_PAGEFLT) {
printf("fault virtual address = 0x%x\n", eva);
- printf("fault code = %s %s, %s\n",
+ printf("fault code = %s %s%s, %s\n",
code & PGEX_U ? "user" : "supervisor",
code & PGEX_W ? "write" : "read",
+#if defined(PAE) || defined(PAE_TABLES)
+ pg_nx != 0 ?
+ (code & PGEX_I ? " instruction" : " data") :
+#endif
+ "",
+ code & PGEX_RSV ? "reserved bits in PTE" :
code & PGEX_P ? "protection violation" : "page not present");
}
printf("instruction pointer = 0x%x:0x%x\n",
OpenPOWER on IntegriCloud