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

    exit_signal: simplify the "we have changed execution 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-simplify-the-we-have-changed-execution-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 e636825346b36a07ccfc8e30946d52855e21f681 Mon Sep 17 00:00:00 2001
From: Oleg Nesterov <[email protected]>
Date: Mon, 19 Mar 2012 17:03:22 +0100
Subject: exit_signal: simplify the "we have changed execution domain" logic

From: Oleg Nesterov <[email protected]>

commit e636825346b36a07ccfc8e30946d52855e21f681 upstream.

exit_notify() checks "tsk->self_exec_id != tsk->parent_exec_id"
to handle the "we have changed execution domain" case.

We can change do_thread() to always set ->exit_signal = SIGCHLD
and remove this check to simplify the code.

We could change setup_new_exec() instead, this looks more logical
because it increments ->self_exec_id. But note that de_thread()
already resets ->exit_signal if it changes the leader, let's keep
both changes close to each other.

Note that we change ->exit_signal lockless, this changes the rules.
Thereafter ->exit_signal is not stable under tasklist but this is
fine, the only possible change is OLDSIG -> SIGCHLD. This can race
with eligible_child() but the race is harmless. We can race with
reparent_leader() which changes our ->exit_signal in parallel, but
it does the same change to SIGCHLD.

The noticeable user-visible change is that the execing task is not
"visible" to do_wait()->eligible_child(__WCLONE) right after exec.
To me this looks more logical, and this is consistent with mt case.

Signed-off-by: Oleg Nesterov <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 fs/exec.c     |    3 +++
 kernel/exit.c |    7 +------
 2 files changed, 4 insertions(+), 6 deletions(-)

--- a/fs/exec.c
+++ b/fs/exec.c
@@ -975,6 +975,9 @@ static int de_thread(struct task_struct
        sig->notify_count = 0;
 
 no_thread_group:
+       /* we have changed execution domain */
+       tsk->exit_signal = SIGCHLD;
+
        if (current->mm)
                setmax_mm_hiwater_rss(&sig->maxrss, current->mm);
 
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -827,14 +827,9 @@ static void exit_notify(struct task_stru
         * 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 our self_exec id doesn't match our parent_exec_id then
-        * we have changed execution domain as these two values started
-        * the same after a fork.
         */
        if (thread_group_leader(tsk) && tsk->exit_signal != SIGCHLD &&
-           (tsk->parent_exec_id != tsk->real_parent->self_exec_id ||
-            tsk->self_exec_id != tsk->parent_exec_id))
+           tsk->parent_exec_id != tsk->real_parent->self_exec_id)
                tsk->exit_signal = SIGCHLD;
 
        if (unlikely(tsk->ptrace)) {


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