diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-07-12 20:10:36 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-19 08:59:15 -0500 |
commit | 1c4042c29bd2e85aac4110552ca8ade763762e84 (patch) | |
tree | 90b34aeae51c9afa088eac37be4e8a14a038e6be | |
parent | 57e8391d327609cbf12d843259c968b9e5c1838f (diff) |
pidns: Consolidate initialzation of special init task state
Instead of setting child_reaper and SIGNAL_UNKILLABLE one way
for the system init process, and another way for pid namespace
init processes test pid->nr == 1 and use the same code for both.
For the global init this results in SIGNAL_UNKILLABLE being set
much earlier in the initialization process.
This is a small cleanup and it paves the way for allowing unshare and
enter of the pid namespace as that path like our global init also will
not set CLONE_NEWPID.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
-rw-r--r-- | init/main.c | 1 | ||||
-rw-r--r-- | kernel/fork.c | 6 |
2 files changed, 3 insertions, 4 deletions
diff --git a/init/main.c b/init/main.c index 9cf77ab138a6..317750a18f74 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -810,7 +810,6 @@ static int __ref kernel_init(void *unused) | |||
810 | system_state = SYSTEM_RUNNING; | 810 | system_state = SYSTEM_RUNNING; |
811 | numa_default_policy(); | 811 | numa_default_policy(); |
812 | 812 | ||
813 | current->signal->flags |= SIGNAL_UNKILLABLE; | ||
814 | flush_delayed_fput(); | 813 | flush_delayed_fput(); |
815 | 814 | ||
816 | if (ramdisk_execute_command) { | 815 | if (ramdisk_execute_command) { |
diff --git a/kernel/fork.c b/kernel/fork.c index 666dc8b06606..0f2bbce311fc 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1039,8 +1039,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
1039 | atomic_set(&sig->live, 1); | 1039 | atomic_set(&sig->live, 1); |
1040 | atomic_set(&sig->sigcnt, 1); | 1040 | atomic_set(&sig->sigcnt, 1); |
1041 | init_waitqueue_head(&sig->wait_chldexit); | 1041 | init_waitqueue_head(&sig->wait_chldexit); |
1042 | if (clone_flags & CLONE_NEWPID) | ||
1043 | sig->flags |= SIGNAL_UNKILLABLE; | ||
1044 | sig->curr_target = tsk; | 1042 | sig->curr_target = tsk; |
1045 | init_sigpending(&sig->shared_pending); | 1043 | init_sigpending(&sig->shared_pending); |
1046 | INIT_LIST_HEAD(&sig->posix_timers); | 1044 | INIT_LIST_HEAD(&sig->posix_timers); |
@@ -1441,8 +1439,10 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1441 | ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); | 1439 | ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); |
1442 | 1440 | ||
1443 | if (thread_group_leader(p)) { | 1441 | if (thread_group_leader(p)) { |
1444 | if (is_child_reaper(pid)) | 1442 | if (is_child_reaper(pid)) { |
1445 | ns_of_pid(pid)->child_reaper = p; | 1443 | ns_of_pid(pid)->child_reaper = p; |
1444 | p->signal->flags |= SIGNAL_UNKILLABLE; | ||
1445 | } | ||
1446 | 1446 | ||
1447 | p->signal->leader_pid = pid; | 1447 | p->signal->leader_pid = pid; |
1448 | p->signal->tty = tty_kref_get(current->signal->tty); | 1448 | p->signal->tty = tty_kref_get(current->signal->tty); |