Skip to content

Commit

Permalink
coredump: zap_threads() must skip kernel threads
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Jul 25, 2008
1 parent 246bb0b commit 15b9f36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 15b9f36

Please sign in to comment.