summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-01-27 22:22:10 +0000
committerjhb <jhb@FreeBSD.org>2006-01-27 22:22:10 +0000
commit2abda0c117f0bf476985583e91dbdcd9b67579d3 (patch)
treeb958d406e447d5697f7c06646b409b17192173b4
parent9b143bcf628f96ba0276241b5418226fa66565f2 (diff)
downloadFreeBSD-src-2abda0c117f0bf476985583e91dbdcd9b67579d3.zip
FreeBSD-src-2abda0c117f0bf476985583e91dbdcd9b67579d3.tar.gz
Call WITNESS_CHECK() in the page fault handler and immediately assume it
is a fatal fault if we are holding any non-sleepable locks. This should cut down on the number of bogus LORs we currently get when the kernel panics due to a NULL (or bogus) pointer dereference that goes wandering off into the VM system which tries to acquire locks and then kicks off the spurious LORs. This should probably be ported to all the archs at some point. Tested on: i386
-rw-r--r--sys/amd64/amd64/trap.c10
-rw-r--r--sys/i386/i386/trap.c14
2 files changed, 20 insertions, 4 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index acd6140..6a8195b 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -237,8 +237,16 @@ trap(frame)
* do the VM lookup, so just consider it a fatal trap so the
* kernel can print out a useful trap message and even get
* to the debugger.
+ *
+ * If we get a page fault while holding a non-sleepable
+ * lock, then it is most likely a fatal kernel page fault.
+ * If WITNESS is enabled, then it's going to whine about
+ * bogus LORs with various VM locks, so just skip to the
+ * fatal trap handling directly.
*/
- if (td->td_critnest != 0)
+ if (td->td_critnest != 0 ||
+ WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL,
+ "Kernel page fault") != 0)
trap_fatal(&frame, frame.tf_addr);
}
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index d392374..928c716 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -265,12 +265,20 @@ trap(frame)
* do the VM lookup, so just consider it a fatal trap so the
* kernel can print out a useful trap message and even get
* to the debugger.
+ *
+ * If we get a page fault while holding a non-sleepable
+ * lock, then it is most likely a fatal kernel page fault.
+ * If WITNESS is enabled, then it's going to whine about
+ * bogus LORs with various VM locks, so just skip to the
+ * fatal trap handling directly.
*/
eva = rcr2();
- if (td->td_critnest == 0)
- enable_intr();
- else
+ if (td->td_critnest != 0 ||
+ WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL,
+ "Kernel page fault") != 0)
trap_fatal(&frame, eva);
+ else
+ enable_intr();
}
if ((ISPL(frame.tf_cs) == SEL_UPL) ||
OpenPOWER on IntegriCloud