diff options
author | Lai Jiangshan | 2010-02-02 15:32:09 +0800 |
---|---|---|
committer | Steven Rostedt | 2010-02-02 10:20:18 -0500 |
commit | 4f48f8b7fd18c44f8478174f9925cc3c059c6ce4 (patch) | |
tree | 94eb6ad3dcf1d381d7b2bc81b3883d6cde98f3ba /kernel/mutex-debug.c | |
parent | ab658321f32770b903a4426e2a6fae0392757755 (diff) |
tracing: Fix circular dead lock in stack trace
When we cat <debugfs>/tracing/stack_trace, we may cause circular lock:
sys_read()
t_start()
arch_spin_lock(&max_stack_lock);
t_show()
seq_printf(), vsnprintf() .... /* they are all trace-able,
when they are traced, max_stack_lock may be required again. */
The following script can trigger this circular dead lock very easy:
#!/bin/bash
echo 1 > /proc/sys/kernel/stack_tracer_enabled
mount -t debugfs xxx /mnt > /dev/null 2>&1
(
# make check_stack() zealous to require max_stack_lock
for ((; ;))
{
echo 1 > /mnt/tracing/stack_max_size
}
) &
for ((; ;))
{
cat /mnt/tracing/stack_trace > /dev/null
}
To fix this bug, we increase the percpu trace_active before
require the lock.
Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
LKML-Reference: <4B67D4F9.9080905@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/mutex-debug.c')
0 files changed, 0 insertions, 0 deletions