diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-03-19 12:03:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 17:16:50 -0400 |
commit | b6e238dceed36891cc633167afe7151f1f3d83c5 (patch) | |
tree | eef4928c1a0cb1b56eb20f8d0ee592709d533f10 /kernel/exit.c | |
parent | e636825346b36a07ccfc8e30946d52855e21f681 (diff) |
exit_signal: fix the "parent has changed security domain" logic
exit_notify() changes ->exit_signal if the parent already did exec.
This doesn't really work, we are not going to send the signal now
if there is another live thread or the exiting task is traced. The
parent can exec before the last dies or the tracer detaches.
Move this check into do_notify_parent() which actually sends the
signal.
The user-visible change is that we do not change ->exit_signal,
and thus the exiting task is still "clone children" for
do_wait()->eligible_child(__WCLONE). Hopefully this is fine, the
current logic is racy anyway.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 51ac4ced1313..ce5f758f40bd 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -818,20 +818,6 @@ static void exit_notify(struct task_struct *tsk, int group_dead) | |||
818 | if (group_dead) | 818 | if (group_dead) |
819 | kill_orphaned_pgrp(tsk->group_leader, NULL); | 819 | kill_orphaned_pgrp(tsk->group_leader, NULL); |
820 | 820 | ||
821 | /* Let father know we died | ||
822 | * | ||
823 | * Thread signals are configurable, but you aren't going to use | ||
824 | * that to send signals to arbitrary processes. | ||
825 | * That stops right now. | ||
826 | * | ||
827 | * If the parent exec id doesn't match the exec id we saved | ||
828 | * when we started then we know the parent has changed security | ||
829 | * domain. | ||
830 | */ | ||
831 | if (thread_group_leader(tsk) && tsk->exit_signal != SIGCHLD && | ||
832 | tsk->parent_exec_id != tsk->real_parent->self_exec_id) | ||
833 | tsk->exit_signal = SIGCHLD; | ||
834 | |||
835 | if (unlikely(tsk->ptrace)) { | 821 | if (unlikely(tsk->ptrace)) { |
836 | int sig = thread_group_leader(tsk) && | 822 | int sig = thread_group_leader(tsk) && |
837 | thread_group_empty(tsk) && | 823 | thread_group_empty(tsk) && |