Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86: Reset the debug_stack update counter

When an NMI goes off and it sees that it preempted the debug stack,
to keep the debug stack safe, it changes the IDT to point to one that
does not modify the stack on breakpoint (to allow breakpoints in NMIs).

But the variable that gets set to know to undo it on exit never gets
cleared on exit. Thus every NMI will reset it on exit the first time
it is done even if it does not need to be reset.

[ Added H. Peter Anvin's suggestion to use this_cpu_read/write ]

Cc: <stable@vger.kernel.org> # v3.3
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Steven Rostedt and committed by
Steven Rostedt
c0525a69 8a4d0a68

+4 -2
+4 -2
arch/x86/kernel/nmi.c
··· 444 444 */ 445 445 if (unlikely(is_debug_stack(regs->sp))) { 446 446 debug_stack_set_zero(); 447 - __get_cpu_var(update_debug_stack) = 1; 447 + this_cpu_write(update_debug_stack, 1); 448 448 } 449 449 } 450 450 451 451 static inline void nmi_nesting_postprocess(void) 452 452 { 453 - if (unlikely(__get_cpu_var(update_debug_stack))) 453 + if (unlikely(this_cpu_read(update_debug_stack))) { 454 454 debug_stack_reset(); 455 + this_cpu_write(update_debug_stack, 0); 456 + } 455 457 } 456 458 #endif 457 459