lkml.org 
[lkml]   [2003]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[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 a fix.


Thanks,
Roland


--- linux-2.5/kernel/exit.c 6 Aug 2003 05:30:45 -0000 1.109
+++ linux-2.5/kernel/exit.c 6 Aug 2003 06:04:02 -0000
@@ -898,13 +898,19 @@ static int wait_task_zombie(task_t *p, u
__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;
}
- write_unlock_irq(&tasklist_lock);
+ else
+ write_unlock_irq(&tasklist_lock);
}
if (p != NULL)
release_task(p);
-
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/
\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.036 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site