From: Oleg Nesterov Date: Mon, 8 Oct 2012 17:13:01 +0000 (+0200) Subject: exec: make de_thread() killable X-Git-Tag: v3.7-rc1~82 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5bbd43d5f450c3fca058f5b85f3dfb4e8cc88c9;p=pandora-kernel.git exec: make de_thread() killable Change de_thread() to use KILLABLE rather than UNINTERRUPTIBLE while waiting for other threads. The only complication is that we should clear ->group_exit_task and ->notify_count before we return, and we should do this under tasklist_lock. -EAGAIN is used to match the initial signal_group_exit() check/return, it doesn't really matter. This fixes the (unlikely) race with coredump. de_thread() checks signal_group_exit() before it starts to kill the subthreads, but this can't help if another CLONE_VM (but non CLONE_THREAD) task starts the coredumping after de_thread() unlocks ->siglock. In this case the killed sub-thread can block in exit_mm() waiting for coredump_finish(), execing thread waits for that sub-thead, and the coredumping thread waits for execing thread. Deadlock. Signed-off-by: Oleg Nesterov Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed