diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index bc551efb5fd4..aa50c848fae7 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1136,16 +1136,6 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1136 | !cpu_online(task_cpu(p)))) | 1136 | !cpu_online(task_cpu(p)))) |
1137 | set_task_cpu(p, smp_processor_id()); | 1137 | set_task_cpu(p, smp_processor_id()); |
1138 | 1138 | ||
1139 | /* | ||
1140 | * Check for pending SIGKILL! The new thread should not be allowed | ||
1141 | * to slip out of an OOM kill. (or normal SIGKILL.) | ||
1142 | */ | ||
1143 | if (sigismember(¤t->pending.signal, SIGKILL)) { | ||
1144 | write_unlock_irq(&tasklist_lock); | ||
1145 | retval = -EINTR; | ||
1146 | goto bad_fork_cleanup_namespace; | ||
1147 | } | ||
1148 | |||
1149 | /* CLONE_PARENT re-uses the old parent */ | 1139 | /* CLONE_PARENT re-uses the old parent */ |
1150 | if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) | 1140 | if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) |
1151 | p->real_parent = current->real_parent; | 1141 | p->real_parent = current->real_parent; |
@@ -1154,6 +1144,23 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1154 | p->parent = p->real_parent; | 1144 | p->parent = p->real_parent; |
1155 | 1145 | ||
1156 | spin_lock(¤t->sighand->siglock); | 1146 | spin_lock(¤t->sighand->siglock); |
1147 | |||
1148 | /* | ||
1149 | * Process group and session signals need to be delivered to just the | ||
1150 | * parent before the fork or both the parent and the child after the | ||
1151 | * fork. Restart if a signal comes in before we add the new process to | ||
1152 | * it's process group. | ||
1153 | * A fatal signal pending means that current will exit, so the new | ||
1154 | * thread can't slip out of an OOM kill (or normal SIGKILL). | ||
1155 | */ | ||
1156 | recalc_sigpending(); | ||
1157 | if (signal_pending(current)) { | ||
1158 | spin_unlock(¤t->sighand->siglock); | ||
1159 | write_unlock_irq(&tasklist_lock); | ||
1160 | retval = -ERESTARTNOINTR; | ||
1161 | goto bad_fork_cleanup_namespace; | ||
1162 | } | ||
1163 | |||
1157 | if (clone_flags & CLONE_THREAD) { | 1164 | if (clone_flags & CLONE_THREAD) { |
1158 | /* | 1165 | /* |
1159 | * Important: if an exit-all has been started then | 1166 | * Important: if an exit-all has been started then |
@@ -1170,16 +1177,6 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1170 | p->group_leader = current->group_leader; | 1177 | p->group_leader = current->group_leader; |
1171 | list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); | 1178 | list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); |
1172 | 1179 | ||
1173 | if (current->signal->group_stop_count > 0) { | ||
1174 | /* | ||
1175 | * There is an all-stop in progress for the group. | ||
1176 | * We ourselves will stop as soon as we check signals. | ||
1177 | * Make the new thread part of that group stop too. | ||
1178 | */ | ||
1179 | current->signal->group_stop_count++; | ||
1180 | set_tsk_thread_flag(p, TIF_SIGPENDING); | ||
1181 | } | ||
1182 | |||
1183 | if (!cputime_eq(current->signal->it_virt_expires, | 1180 | if (!cputime_eq(current->signal->it_virt_expires, |
1184 | cputime_zero) || | 1181 | cputime_zero) || |
1185 | !cputime_eq(current->signal->it_prof_expires, | 1182 | !cputime_eq(current->signal->it_prof_expires, |