Oleg Nesterov 3245d6acab exit: fix race between wait_consider_task() and wait_task_zombie()
wait_consider_task() checks EXIT_ZOMBIE after EXIT_DEAD/EXIT_TRACE and
both checks can fail if we race with EXIT_ZOMBIE -> EXIT_DEAD/EXIT_TRACE
change in between, gcc needs to reload p->exit_state after
security_task_wait().  In this case ->notask_error will be wrongly
cleared and do_wait() can hang forever if it was the last eligible
child.

Many thanks to Arne who carefully investigated the problem.

Note: this bug is very old but it was pure theoretical until commit
b3ab03160dfa ("wait: completely ignore the EXIT_DEAD tasks").  Before
this commit "-O2" was probably enough to guarantee that compiler won't
read ->exit_state twice.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Arne Goedeke <el@laramies.com>
Tested-by: Arne Goedeke <el@laramies.com>
Cc: <stable@vger.kernel.org>	[3.15+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-01-08 15:10:51 -08:00
..
2014-12-19 22:55:06 +01:00
2014-10-09 22:26:04 -04:00
2014-10-09 22:26:04 -04:00
2014-09-23 16:37:51 -04:00
2014-08-08 15:57:18 -07:00
2014-11-18 02:49:52 -05:00
2014-11-03 19:21:01 -08:00
2014-09-10 15:42:12 -07:00
2014-12-04 14:34:54 -05:00
2014-12-10 17:41:10 -08:00
2014-12-10 17:41:10 -08:00
2014-11-19 13:01:25 -05:00