Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1253810 > unrolled thread

[PATCH 2/2] tracing: Do not allow stack_tracer to record stack in NMI

Started bySteven Rostedt <rostedt@goodmis.org>
First post2015-10-22 15:30 +0200
Last post2015-10-22 15:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] tracing: Do not allow stack_tracer to record stack in NMI Steven Rostedt <rostedt@goodmis.org> - 2015-10-22 15:30 +0200

#1253810 — [PATCH 2/2] tracing: Do not allow stack_tracer to record stack in NMI

FromSteven Rostedt <rostedt@goodmis.org>
Date2015-10-22 15:30 +0200
Subject[PATCH 2/2] tracing: Do not allow stack_tracer to record stack in NMI
Message-ID<qmo6o-3GO-31@gated-at.bofh.it>
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

The code in stack tracer should not be executed within an NMI as it grabs
spinlocks and stack tracing an NMI gives the possibility of causing a
deadlock. Although this is safe on x86_64, because it does not perform stack
traces when the task struct stack is not in use (interrupts and NMIs), it
may be an issue for NMIs on i386 and other archs that use the same stack as
the NMI.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_stack.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 5f29402bff0f..8abf1ba18085 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -85,6 +85,10 @@ check_stack(unsigned long ip, unsigned long *stack)
 	if (!object_is_on_stack(stack))
 		return;
 
+	/* Can't do this from NMI context (can cause deadlocks) */
+	if (in_nmi())
+		return;
+
 	local_irq_save(flags);
 	arch_spin_lock(&max_stack_lock);
 
-- 
2.6.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web