All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] coredump: zap_threads() must skip kernel threads
@ 2008-06-01 15:30 Oleg Nesterov
  2008-06-03 21:15 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2008-06-01 15:30 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Eric W. Biederman, Ingo Molnar, Linus Torvalds, Roland McGrath,
	linux-kernel

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>

--- 26-rc2/fs/exec.c~3_CD_FIX_RACE_USE_MM	2008-05-31 20:05:21.000000000 +0400
+++ 26-rc2/fs/exec.c	2008-06-01 19:04:39.000000000 +0400
@@ -1568,11 +1568,13 @@ static inline int zap_threads(struct tas
 	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);


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-04  7:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-01 15:30 [PATCH 3/3] coredump: zap_threads() must skip kernel threads Oleg Nesterov
2008-06-03 21:15 ` Andrew Morton
2008-06-03 21:49   ` Roland McGrath
2008-06-04  7:57     ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.