aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 242a706e772..4854c2c4a82 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -851,13 +851,14 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
851 sig->tty_old_pgrp = NULL; 851 sig->tty_old_pgrp = NULL;
852 sig->tty = NULL; 852 sig->tty = NULL;
853 853
854 sig->cutime = sig->cstime = cputime_zero; 854 sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero;
855 sig->gtime = cputime_zero; 855 sig->gtime = cputime_zero;
856 sig->cgtime = cputime_zero; 856 sig->cgtime = cputime_zero;
857 sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; 857 sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0;
858 sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; 858 sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0;
859 sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; 859 sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0;
860 task_io_accounting_init(&sig->ioac); 860 task_io_accounting_init(&sig->ioac);
861 sig->sum_sched_runtime = 0;
861 taskstats_tgid_init(sig); 862 taskstats_tgid_init(sig);
862 863
863 task_lock(current->group_leader); 864 task_lock(current->group_leader);
@@ -1005,6 +1006,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1005 * triggers too late. This doesn't hurt, the check is only there 1006 * triggers too late. This doesn't hurt, the check is only there
1006 * to stop root fork bombs. 1007 * to stop root fork bombs.
1007 */ 1008 */
1009 retval = -EAGAIN;
1008 if (nr_threads >= max_threads) 1010 if (nr_threads >= max_threads)
1009 goto bad_fork_cleanup_count; 1011 goto bad_fork_cleanup_count;
1010 1012
@@ -1093,7 +1095,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1093#ifdef CONFIG_DEBUG_MUTEXES 1095#ifdef CONFIG_DEBUG_MUTEXES
1094 p->blocked_on = NULL; /* not blocked yet */ 1096 p->blocked_on = NULL; /* not blocked yet */
1095#endif 1097#endif
1096 if (unlikely(ptrace_reparented(current))) 1098 if (unlikely(current->ptrace))
1097 ptrace_fork(p, clone_flags); 1099 ptrace_fork(p, clone_flags);
1098 1100
1099 /* Perform scheduler related setup. Assign this task to a CPU. */ 1101 /* Perform scheduler related setup. Assign this task to a CPU. */
@@ -1177,10 +1179,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1177#endif 1179#endif
1178 clear_all_latency_tracing(p); 1180 clear_all_latency_tracing(p);
1179 1181
1180 /* Our parent execution domain becomes current domain
1181 These must match for thread signalling to apply */
1182 p->parent_exec_id = p->self_exec_id;
1183
1184 /* ok, now we should be set up.. */ 1182 /* ok, now we should be set up.. */
1185 p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL); 1183 p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL);
1186 p->pdeath_signal = 0; 1184 p->pdeath_signal = 0;
@@ -1218,10 +1216,13 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1218 set_task_cpu(p, smp_processor_id()); 1216 set_task_cpu(p, smp_processor_id());
1219 1217
1220 /* CLONE_PARENT re-uses the old parent */ 1218 /* CLONE_PARENT re-uses the old parent */
1221 if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) 1219 if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
1222 p->real_parent = current->real_parent; 1220 p->real_parent = current->real_parent;
1223 else 1221 p->parent_exec_id = current->parent_exec_id;
1222 } else {
1224 p->real_parent = current; 1223 p->real_parent = current;
1224 p->parent_exec_id = current->self_exec_id;
1225 }
1225 1226
1226 spin_lock(&current->sighand->siglock); 1227 spin_lock(&current->sighand->siglock);
1227 1228