aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/fault.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2010-09-27 12:50:51 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-10-14 14:43:36 -0400
commitebc8827f75954fe315492883eee5cb3f355d547d (patch)
treecba111948a3451550f5d075454648ae4c8f6bada /arch/x86/mm/fault.c
parent14cae9bd2faf6d0d75702c2e107e75207bcdfec1 (diff)
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/fault.c')
-rw-r--r--arch/x86/mm/fault.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 4c4508e8a204..a24c6cfdccc4 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -251,6 +251,8 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
251 if (!(address >= VMALLOC_START && address < VMALLOC_END)) 251 if (!(address >= VMALLOC_START && address < VMALLOC_END))
252 return -1; 252 return -1;
253 253
254 WARN_ON_ONCE(in_nmi());
255
254 /* 256 /*
255 * Synchronize this task's top level page-table 257 * Synchronize this task's top level page-table
256 * with the 'reference' page table. 258 * with the 'reference' page table.
@@ -369,6 +371,8 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
369 if (!(address >= VMALLOC_START && address < VMALLOC_END)) 371 if (!(address >= VMALLOC_START && address < VMALLOC_END))
370 return -1; 372 return -1;
371 373
374 WARN_ON_ONCE(in_nmi());
375
372 /* 376 /*
373 * Copy kernel mappings over when needed. This can also 377 * Copy kernel mappings over when needed. This can also
374 * happen within a race in page table update. In the later 378 * happen within a race in page table update. In the later