Commit 1c4042c2 authored by Eric W. Biederman's avatar Eric W. Biederman

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: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 57e8391d
...@@ -810,7 +810,6 @@ static int __ref kernel_init(void *unused) ...@@ -810,7 +810,6 @@ static int __ref kernel_init(void *unused)
system_state = SYSTEM_RUNNING; system_state = SYSTEM_RUNNING;
numa_default_policy(); numa_default_policy();
current->signal->flags |= SIGNAL_UNKILLABLE;
flush_delayed_fput(); flush_delayed_fput();
if (ramdisk_execute_command) { if (ramdisk_execute_command) {
......
...@@ -1039,8 +1039,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) ...@@ -1039,8 +1039,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
atomic_set(&sig->live, 1); atomic_set(&sig->live, 1);
atomic_set(&sig->sigcnt, 1); atomic_set(&sig->sigcnt, 1);
init_waitqueue_head(&sig->wait_chldexit); init_waitqueue_head(&sig->wait_chldexit);
if (clone_flags & CLONE_NEWPID)
sig->flags |= SIGNAL_UNKILLABLE;
sig->curr_target = tsk; sig->curr_target = tsk;
init_sigpending(&sig->shared_pending); init_sigpending(&sig->shared_pending);
INIT_LIST_HEAD(&sig->posix_timers); INIT_LIST_HEAD(&sig->posix_timers);
...@@ -1441,8 +1439,10 @@ static struct task_struct *copy_process(unsigned long clone_flags, ...@@ -1441,8 +1439,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
if (thread_group_leader(p)) { if (thread_group_leader(p)) {
if (is_child_reaper(pid)) if (is_child_reaper(pid)) {
ns_of_pid(pid)->child_reaper = p; ns_of_pid(pid)->child_reaper = p;
p->signal->flags |= SIGNAL_UNKILLABLE;
}
p->signal->leader_pid = pid; p->signal->leader_pid = pid;
p->signal->tty = tty_kref_get(current->signal->tty); p->signal->tty = tty_kref_get(current->signal->tty);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment