Oleg Nesterov bb6f6dbaa4 [PATCH] do_coredump() should reset group_stop_count earlier
__group_complete_signal() sets ->group_stop_count in sig_kernel_coredump()
path and marks the target thread as ->group_exit_task.  So any thread
except group_exit_task will go to handle_group_stop()->finish_stop().

However, when group_exit_task actually starts do_coredump(), it sets
SIGNAL_GROUP_EXIT, but does not reset ->group_stop_count while killing
other threads.  If we have not yet stopped threads in the same thread
group, they all will spin in kernel mode until group_exit_task sends them
SIGKILL, because ->group_stop_count > 0 means:

	recalc_sigpending_tsk() never clears TIF_SIGPENDING

	get_signal_to_deliver() goes to handle_group_stop()

	handle_group_stop() returns when SIGNAL_GROUP_EXIT set

	syscall_exit/resume_userspace notice TIF_SIGPENDING,
	call get_signal_to_deliver() again.

So we are wasting cpu cycles, and if one of these threads is rt_task() this
may be a serious problem.

NOTE: do_coredump() holds ->mmap_sem, so not stopped threads can't escape
coredumping after clearing ->group_stop_count.

See also this thread: http://marc.theaimsgroup.com/?t=112739139900002

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:55 -08:00
..
2005-11-07 07:54:06 -08:00
2005-11-07 07:54:06 -08:00
2005-11-07 07:54:06 -08:00
2005-11-08 16:54:53 +01:00
2005-10-04 13:22:01 -07:00
2005-11-07 07:54:06 -08:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2006-01-06 08:33:20 -08:00
2005-11-07 07:54:06 -08:00
2006-01-06 08:33:59 -08:00
2006-01-06 14:58:56 -05:00
2006-01-06 14:58:56 -05:00
2005-05-05 16:36:47 -07:00
2005-11-07 07:54:06 -08:00
2006-01-06 08:33:53 -08:00
2006-01-03 13:27:11 +01:00
2006-01-08 20:13:48 -08:00
2005-05-05 16:36:47 -07:00
2005-11-07 07:54:06 -08:00
2005-11-07 07:54:06 -08:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2005-07-12 16:01:02 -07:00
2005-10-29 21:40:39 -07:00
2005-04-16 15:20:36 -07:00
2006-01-08 20:12:40 -08:00
2005-09-09 13:57:55 -07:00
2005-04-16 15:20:36 -07:00
2005-10-30 17:37:32 -08:00
2005-04-16 15:20:36 -07:00
2006-01-06 14:58:54 -05:00
2006-01-08 20:12:40 -08:00
2005-11-07 07:54:06 -08:00
2005-04-16 15:20:36 -07:00
2005-09-10 10:06:22 -07:00
2005-11-07 18:18:11 -08:00
2005-11-07 18:18:11 -08:00
2005-04-16 15:20:36 -07:00
2005-11-07 07:53:39 -08:00
2005-04-16 15:20:36 -07:00
2005-09-09 13:57:55 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00