Commit 23d2f992 authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

Fix up thinko in nasty "NMI while debug while systenter"

codepath.

The bug was that the NMI stack fixup triggered even if the
debug exception had _not_ happened on the exact sysenter
entrypoint. The new version should be more robust.
parent a5ce42e4
...@@ -497,13 +497,19 @@ debug_stack_correct: ...@@ -497,13 +497,19 @@ debug_stack_correct:
pushl $do_debug pushl $do_debug
jmp error_code jmp error_code
/*
* NMI is doubly nasty. It can happen _while_ we're handling
* a debug fault, and the debug fault hasn't yet been able to
* clear up the stack. So we first check whether we got an
* NMI on the sysenter entry path, but after that we need to
* check whether we got an NMI on the debug path where the debug
* fault happened on the sysenter path.
*/
ENTRY(nmi) ENTRY(nmi)
cmpl $sysenter_entry,(%esp) cmpl $sysenter_entry,(%esp)
je nmi_stack_fixup je nmi_stack_fixup
cmpl $debug - 1,(%esp) cmpl $sysenter_entry,12(%esp)
jle nmi_stack_correct je nmi_debug_stack_check
cmpl $debug_esp_fix_insn,(%esp)
jle nmi_debug_stack_fixup
nmi_stack_correct: nmi_stack_correct:
pushl %eax pushl %eax
SAVE_ALL SAVE_ALL
...@@ -517,6 +523,13 @@ nmi_stack_correct: ...@@ -517,6 +523,13 @@ nmi_stack_correct:
nmi_stack_fixup: nmi_stack_fixup:
FIX_STACK(12,nmi_stack_correct, 1) FIX_STACK(12,nmi_stack_correct, 1)
jmp nmi_stack_correct jmp nmi_stack_correct
nmi_debug_stack_check:
cmpw $__KERNEL_CS,16(%esp)
jne nmi_stack_correct
cmpl $debug - 1,(%esp)
jle nmi_stack_correct
cmpl $debug_esp_fix_insn,(%esp)
jle nmi_debug_stack_fixup
nmi_debug_stack_fixup: nmi_debug_stack_fixup:
FIX_STACK(24,nmi_stack_correct, 1) FIX_STACK(24,nmi_stack_correct, 1)
jmp nmi_stack_correct jmp nmi_stack_correct
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment