This is a note to let you know that I've just added the patch titled

    exit_signal: fix the "parent has changed security domain" logic

to the 3.3-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     exit_signal-fix-the-parent-has-changed-security-domain-logic.patch
and it can be found in the queue-3.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From b6e238dceed36891cc633167afe7151f1f3d83c5 Mon Sep 17 00:00:00 2001
From: Oleg Nesterov <[email protected]>
Date: Mon, 19 Mar 2012 17:03:41 +0100
Subject: exit_signal: fix the "parent has changed security domain" logic

From: Oleg Nesterov <[email protected]>

commit b6e238dceed36891cc633167afe7151f1f3d83c5 upstream.

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 <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 kernel/exit.c   |   14 --------------
 kernel/signal.c |    9 +++++++++
 2 files changed, 9 insertions(+), 14 deletions(-)

--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -818,20 +818,6 @@ static void exit_notify(struct task_stru
        if (group_dead)
                kill_orphaned_pgrp(tsk->group_leader, NULL);
 
-       /* Let father know we died
-        *
-        * Thread signals are configurable, but you aren't going to use
-        * that to send signals to arbitrary processes.
-        * That stops right now.
-        *
-        * If the parent exec id doesn't match the exec id we saved
-        * when we started then we know the parent has changed security
-        * domain.
-        */
-       if (thread_group_leader(tsk) && tsk->exit_signal != SIGCHLD &&
-           tsk->parent_exec_id != tsk->real_parent->self_exec_id)
-               tsk->exit_signal = SIGCHLD;
-
        if (unlikely(tsk->ptrace)) {
                int sig = thread_group_leader(tsk) &&
                                thread_group_empty(tsk) &&
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1642,6 +1642,15 @@ bool do_notify_parent(struct task_struct
        BUG_ON(!tsk->ptrace &&
               (tsk->group_leader != tsk || !thread_group_empty(tsk)));
 
+       if (sig != SIGCHLD) {
+               /*
+                * This is only possible if parent == real_parent.
+                * Check if it has changed security domain.
+                */
+               if (tsk->parent_exec_id != tsk->parent->self_exec_id)
+                       sig = SIGCHLD;
+       }
+
        info.si_signo = sig;
        info.si_errno = 0;
        /*


Patches currently in stable-queue which might be from [email protected] are

queue-3.3/exit_signal-simplify-the-we-have-changed-execution-domain-logic.patch
queue-3.3/i387-ptrace-breaks-the-lazy-fpu-restore-logic.patch
queue-3.3/exit_signal-fix-the-parent-has-changed-security-domain-logic.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to