]> err.no Git - linux-2.6/commitdiff
coredump: zap_threads() must skip kernel threads
authorOleg Nesterov <oleg@tv-sign.ru>
Fri, 25 Jul 2008 08:47:39 +0000 (01:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Jul 2008 17:53:39 +0000 (10:53 -0700)
The main loop in zap_threads() must skip kthreads which may use the same
mm.  Otherwise we "kill" this thread erroneously (for example, it can not
fork or exec after that), and the coredumping task stucks in the
TASK_UNINTERRUPTIBLE state forever because of the wrong ->core_waiters
count.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/exec.c

index cd2e8c9b12494f6df3f25663f6dbdd6ec19ca8a5..e347e6ed1617bd1d50013042eb0dc2947060ebb6 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1574,11 +1574,12 @@ static inline int zap_threads(struct task_struct *tsk, struct mm_struct *mm,
        for_each_process(g) {
                if (g == tsk->group_leader)
                        continue;
-
+               if (g->flags & PF_KTHREAD)
+                       continue;
                p = g;
                do {
                        if (p->mm) {
-                               if (p->mm == mm) {
+                               if (unlikely(p->mm == mm)) {
                                        lock_task_sighand(p, &flags);
                                        zap_process(p);
                                        unlock_task_sighand(p, &flags);