Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5cd17569fd0eeca510735e63a6061291e3971bf6
Commit:     5cd17569fd0eeca510735e63a6061291e3971bf6
Parent:     e00ba3dae077f54cfd2af42e939a618caa7a3bca
Author:     Eric W. Biederman <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 4 23:45:04 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Dec 5 09:21:18 2007 -0800

    fix clone(CLONE_NEWPID)
    
    Currently we are complicating the code in copy_process, the clone ABI, and
    if we fix the bugs sys_setsid itself, with an unnecessary open coded
    version of sys_setsid.
    
    So just simplify everything and don't special case the session and pgrp of
    the initial process in a pid namespace.
    
    Having this special case actually presents to user space the classic linux
    startup conditions with session == pgrp == 0 for /sbin/init.
    
    We already handle sending signals to processes in a child pid namespace.
    
    We need to handle sending signals to processes in a parent pid namespace
    for cases like SIGCHILD and SIGIO.
    
    This makes nothing extra visible inside a pid namespace.  So this extra
    special case appears to have no redeeming merits.
    
    Further removing this special case increases the flexibility of how we can
    use pid namespaces, by not requiring the initial process in a pid namespace
    to be a daemon.
    
    Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]>
    Cc: Oleg Nesterov <[EMAIL PROTECTED]>
    Cc: Pavel Emelyanov <[EMAIL PROTECTED]>
    Cc: Sukadev Bhattiprolu <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/fork.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 8ca1a14..8dd8ff2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1292,23 +1292,14 @@ static struct task_struct *copy_process(unsigned long 
clone_flags,
                        __ptrace_link(p, current->parent);
 
                if (thread_group_leader(p)) {
-                       if (clone_flags & CLONE_NEWPID) {
+                       if (clone_flags & CLONE_NEWPID)
                                p->nsproxy->pid_ns->child_reaper = p;
-                               p->signal->tty = NULL;
-                               set_task_pgrp(p, p->pid);
-                               set_task_session(p, p->pid);
-                               attach_pid(p, PIDTYPE_PGID, pid);
-                               attach_pid(p, PIDTYPE_SID, pid);
-                       } else {
-                               p->signal->tty = current->signal->tty;
-                               set_task_pgrp(p, task_pgrp_nr(current));
-                               set_task_session(p, task_session_nr(current));
-                               attach_pid(p, PIDTYPE_PGID,
-                                               task_pgrp(current));
-                               attach_pid(p, PIDTYPE_SID,
-                                               task_session(current));
-                       }
 
+                       p->signal->tty = current->signal->tty;
+                       set_task_pgrp(p, task_pgrp_nr(current));
+                       set_task_session(p, task_session_nr(current));
+                       attach_pid(p, PIDTYPE_PGID, task_pgrp(current));
+                       attach_pid(p, PIDTYPE_SID, task_session(current));
                        list_add_tail_rcu(&p->tasks, &init_task.tasks);
                        __get_cpu_var(process_counts)++;
                }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to