aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@parallels.com>2015-04-16 15:48:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-17 09:04:07 -0400
commitdfcce791fb0ad06f3f0b745a23160b9d8858fe39 (patch)
treea3c49070946f205a96642688af0daf5cd3c3c432 /fs/exec.c
parent6e399cd144d8500ffb5d40fa6848890e2580a80a (diff)
fs/exec.c:de_thread: move notify_count write under lock
We set sig->notify_count = -1 between RELEASE and ACQUIRE operations: spin_unlock_irq(lock); ... if (!thread_group_leader(tsk)) { ... for (;;) { sig->notify_count = -1; write_lock_irq(&tasklist_lock); There are no restriction on it so other processors may see this STORE mixed with other STOREs in both areas limited by the spinlocks. Probably, it may be reordered with the above sig->group_exit_task = tsk; sig->notify_count = zap_other_threads(tsk); in some way. Set it under tasklist_lock locked to be sure nothing will be reordered. Signed-off-by: Kirill Tkhai <ktkhai@parallels.com> Acked-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/exec.c b/fs/exec.c
index a5fef835ebc5..02bfd980a40c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -926,10 +926,14 @@ static int de_thread(struct task_struct *tsk)
926 if (!thread_group_leader(tsk)) { 926 if (!thread_group_leader(tsk)) {
927 struct task_struct *leader = tsk->group_leader; 927 struct task_struct *leader = tsk->group_leader;
928 928
929 sig->notify_count = -1; /* for exit_notify() */
930 for (;;) { 929 for (;;) {
931 threadgroup_change_begin(tsk); 930 threadgroup_change_begin(tsk);
932 write_lock_irq(&tasklist_lock); 931 write_lock_irq(&tasklist_lock);
932 /*
933 * Do this under tasklist_lock to ensure that
934 * exit_notify() can't miss ->group_exit_task
935 */
936 sig->notify_count = -1;
933 if (likely(leader->exit_state)) 937 if (likely(leader->exit_state))
934 break; 938 break;
935 __set_current_state(TASK_KILLABLE); 939 __set_current_state(TASK_KILLABLE);