[PATCH 3/5] x86: Reset the debug_stack update counter

From: Steven Rostedt
Date: Wed May 30 2012 - 22:05:14 EST


From: Steven Rostedt <srostedt@xxxxxxxxxx>

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.

Cc: <stable@xxxxxxxxxxxxxxx> # v3.3
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
arch/x86/kernel/nmi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 9087527..c1fffc5 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -450,8 +450,10 @@ static inline void nmi_nesting_preprocess(struct pt_regs *regs)

static inline void nmi_nesting_postprocess(void)
{
- if (unlikely(__get_cpu_var(update_debug_stack)))
+ if (unlikely(__get_cpu_var(update_debug_stack))) {
debug_stack_reset();
+ __get_cpu_var(update_debug_stack) = 0;
+ }
}
#endif

--
1.7.10


Attachment: signature.asc
Description: This is a digitally signed message part