summaryrefslogtreecommitdiff
path: root/arch/x86/mm/kmemcheck
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2010-09-27 20:50:51 +0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-10-14 22:43:36 +0400
commitebc8827f75954fe315492883eee5cb3f355d547d (patch)
treecba111948a3451550f5d075454648ae4c8f6bada /arch/x86/mm/kmemcheck
parent14cae9bd2faf6d0d75702c2e107e75207bcdfec1 (diff)
downloadlinux-ebc8827f75954fe315492883eee5cb3f355d547d.tar.xz
x86: Barf when vmalloc and kmemcheck faults happen in NMI
In x86, faults exit by executing the iret instruction, which then reenables NMIs if we faulted in NMI context. Then if a fault happens in NMI, another NMI can nest after the fault exits. But we don't yet support nested NMIs because we have only one NMI stack. To prevent from that, check that vmalloc and kmemcheck faults don't happen in this context. Most of the other kernel faults in NMIs can be more easily spotted by finding explicit copy_from,to_user() calls on review. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Diffstat (limited to 'arch/x86/mm/kmemcheck')
-rw-r--r--arch/x86/mm/kmemcheck/kmemcheck.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index b3b531a4f8e5..d87dd6d042d6 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -631,6 +631,8 @@ bool kmemcheck_fault(struct pt_regs *regs, unsigned long address,
if (!pte)
return false;
+ WARN_ON_ONCE(in_nmi());
+
if (error_code & 2)
kmemcheck_access(regs, address, KMEMCHECK_WRITE);
else