Commit 4bce3300 authored by Roland McGrath's avatar Roland McGrath Committed by Linus Torvalds

[PATCH] fix spinlock deadlock in ptrace-reaping of detached thread

When a dead detached thread has been temporarily zombified because it's
ptraced and its tracer tries to reap it, it deadlocks on SMP.

Here's the fix.
parent 1c2a284f
......@@ -898,12 +898,18 @@ static int wait_task_zombie(task_t *p, unsigned int *stat_addr, struct rusage *r
__ptrace_unlink(p);
p->state = TASK_ZOMBIE;
/* If this is a detached thread, this is where it goes away. */
if (p->exit_signal == -1)
if (p->exit_signal == -1) {
/* release_task takes the lock itself. */
write_unlock_irq(&tasklist_lock);
release_task (p);
else
}
else {
do_notify_parent(p, p->exit_signal);
write_unlock_irq(&tasklist_lock);
}
p = NULL;
}
else
write_unlock_irq(&tasklist_lock);
}
if (p != NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment