x86/nmi/64: Make the "NMI executing" variable more consistent
authorAndy Lutomirski <luto@kernel.org>
Wed, 15 Jul 2015 17:29:40 +0000 (10:29 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 17 Jul 2015 10:50:13 +0000 (12:50 +0200)
Currently, "NMI executing" is one the first time an outermost
NMI hits repeat_nmi and zero thereafter.  Change it to be zero
each time for consistency.

This is intended to help NMI handling fail harder if it's buggy.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/entry/entry_64.S

index 0fb52526e452cf3b850004c53addb743fedcb12f..5422bd20bdf4cdfb3dd4867c6fd8e3049a7d954f 100644 (file)
@@ -1441,8 +1441,8 @@ first_nmi:
        /* Restore rdx. */
        movq    (%rsp), %rdx
 
-       /* Set "NMI executing" on the stack. */
-       pushq   $1
+       /* Make room for "NMI executing". */
+       pushq   $0
 
        /* Leave room for the "iret" frame */
        subq    $(5*8), %rsp
@@ -1467,11 +1467,10 @@ repeat_nmi:
         * RSP is pointing to "outermost RIP".  gsbase is unknown, but, if
         * we're repeating an NMI, gsbase has the same value that it had on
         * the first iteration.  paranoid_entry will load the kernel
-        * gsbase if needed before we call do_nmi.
-        *
-        * Set "NMI executing" in case we came back here via IRET.
+        * gsbase if needed before we call do_nmi.  "NMI executing"
+        * is zero.
         */
-       movq    $1, 10*8(%rsp)
+       movq    $1, 10*8(%rsp)          /* Set "NMI executing". */
 
        /*
         * Copy the "outermost" frame to the "iret" frame.  NMIs that nest