Commit 1291cf41 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

[PATCH] fix de_thread() vs do_coredump() deadlock



de_thread() sends SIGKILL to all sub-threads and waits them to die in 'D'
state.  It is possible that one of the threads already dequeued coredump
signal.  When de_thread() unlocks ->sighand->lock that thread can enter
do_coredump()->coredump_wait() and cause a deadlock.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f7232056
...@@ -1460,11 +1460,21 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) ...@@ -1460,11 +1460,21 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
current->fsuid = 0; /* Dump root private */ current->fsuid = 0; /* Dump root private */
} }
mm->dumpable = 0; mm->dumpable = 0;
init_completion(&mm->core_done);
retval = -EAGAIN;
spin_lock_irq(&current->sighand->siglock); spin_lock_irq(&current->sighand->siglock);
current->signal->flags = SIGNAL_GROUP_EXIT; if (!(current->signal->flags & SIGNAL_GROUP_EXIT)) {
current->signal->group_exit_code = exit_code; current->signal->flags = SIGNAL_GROUP_EXIT;
current->signal->group_exit_code = exit_code;
retval = 0;
}
spin_unlock_irq(&current->sighand->siglock); spin_unlock_irq(&current->sighand->siglock);
if (retval) {
up_write(&mm->mmap_sem);
goto fail;
}
init_completion(&mm->core_done);
coredump_wait(mm); coredump_wait(mm);
/* /*
......
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