Commit 36f1a77b authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Ingo Molnar

x86/nmi/64: Make the "NMI executing" variable more consistent

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: default avatarAndy Lutomirski <luto@kernel.org>
Reviewed-by: default avatarSteven 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: default avatarIngo Molnar <mingo@kernel.org>
parent 23a781e9
...@@ -1441,8 +1441,8 @@ first_nmi: ...@@ -1441,8 +1441,8 @@ first_nmi:
/* Restore rdx. */ /* Restore rdx. */
movq (%rsp), %rdx movq (%rsp), %rdx
/* Set "NMI executing" on the stack. */ /* Make room for "NMI executing". */
pushq $1 pushq $0
/* Leave room for the "iret" frame */ /* Leave room for the "iret" frame */
subq $(5*8), %rsp subq $(5*8), %rsp
...@@ -1467,11 +1467,10 @@ repeat_nmi: ...@@ -1467,11 +1467,10 @@ repeat_nmi:
* RSP is pointing to "outermost RIP". gsbase is unknown, but, if * 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 * we're repeating an NMI, gsbase has the same value that it had on
* the first iteration. paranoid_entry will load the kernel * the first iteration. paranoid_entry will load the kernel
* gsbase if needed before we call do_nmi. * gsbase if needed before we call do_nmi. "NMI executing"
* * is zero.
* Set "NMI executing" in case we came back here via IRET.
*/ */
movq $1, 10*8(%rsp) movq $1, 10*8(%rsp) /* Set "NMI executing". */
/* /*
* Copy the "outermost" frame to the "iret" frame. NMIs that nest * Copy the "outermost" frame to the "iret" frame. NMIs that nest
......
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