summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_stack.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-10-21 03:48:02 +0200
committerSteven Rostedt <rostedt@goodmis.org>2015-10-21 03:52:23 +0200
commit1904be1b6bb92058c8e00063dd59df2df294e258 (patch)
treefbf8a095701cb1edaf325021f67ac0acf00d6c4b /kernel/trace/trace_stack.c
parenttracing: Have stack tracer force RCU to be watching (diff)
downloadlinux-1904be1b6bb92058c8e00063dd59df2df294e258.tar.xz
linux-1904be1b6bb92058c8e00063dd59df2df294e258.zip
tracing: Do not allow stack_tracer to record stack in NMI
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>
Diffstat (limited to '')
-rw-r--r--kernel/trace/trace_stack.c4
1 files changed, 4 insertions, 0 deletions
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);