aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 3d6f121bbe8a..5b2959b3ffc2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -64,6 +64,7 @@
64#include <linux/magic.h> 64#include <linux/magic.h>
65#include <linux/perf_event.h> 65#include <linux/perf_event.h>
66#include <linux/posix-timers.h> 66#include <linux/posix-timers.h>
67#include <linux/user-return-notifier.h>
67 68
68#include <asm/pgtable.h> 69#include <asm/pgtable.h>
69#include <asm/pgalloc.h> 70#include <asm/pgalloc.h>
@@ -249,6 +250,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
249 goto out; 250 goto out;
250 251
251 setup_thread_stack(tsk, orig); 252 setup_thread_stack(tsk, orig);
253 clear_user_return_notifier(tsk);
252 stackend = end_of_stack(tsk); 254 stackend = end_of_stack(tsk);
253 *stackend = STACK_END_MAGIC; /* for overflow detection */ 255 *stackend = STACK_END_MAGIC; /* for overflow detection */
254 256
@@ -937,9 +939,9 @@ SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
937 939
938static void rt_mutex_init_task(struct task_struct *p) 940static void rt_mutex_init_task(struct task_struct *p)
939{ 941{
940 spin_lock_init(&p->pi_lock); 942 raw_spin_lock_init(&p->pi_lock);
941#ifdef CONFIG_RT_MUTEXES 943#ifdef CONFIG_RT_MUTEXES
942 plist_head_init(&p->pi_waiters, &p->pi_lock); 944 plist_head_init_raw(&p->pi_waiters, &p->pi_lock);
943 p->pi_blocked_on = NULL; 945 p->pi_blocked_on = NULL;
944#endif 946#endif
945} 947}
@@ -1125,6 +1127,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1125#ifdef CONFIG_DEBUG_MUTEXES 1127#ifdef CONFIG_DEBUG_MUTEXES
1126 p->blocked_on = NULL; /* not blocked yet */ 1128 p->blocked_on = NULL; /* not blocked yet */
1127#endif 1129#endif
1130#ifdef CONFIG_CGROUP_MEM_RES_CTLR
1131 p->memcg_batch.do_batch = 0;
1132 p->memcg_batch.memcg = NULL;
1133#endif
1128 1134
1129 p->bts = NULL; 1135 p->bts = NULL;
1130 1136
@@ -1204,9 +1210,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1204 p->sas_ss_sp = p->sas_ss_size = 0; 1210 p->sas_ss_sp = p->sas_ss_size = 0;
1205 1211
1206 /* 1212 /*
1207 * Syscall tracing should be turned off in the child regardless 1213 * Syscall tracing and stepping should be turned off in the
1208 * of CLONE_PTRACE. 1214 * child regardless of CLONE_PTRACE.
1209 */ 1215 */
1216 user_disable_single_step(p);
1210 clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE); 1217 clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);
1211#ifdef TIF_SYSCALL_EMU 1218#ifdef TIF_SYSCALL_EMU
1212 clear_tsk_thread_flag(p, TIF_SYSCALL_EMU); 1219 clear_tsk_thread_flag(p, TIF_SYSCALL_EMU);
@@ -1284,7 +1291,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1284 } 1291 }
1285 1292
1286 if (likely(p->pid)) { 1293 if (likely(p->pid)) {
1287 list_add_tail(&p->sibling, &p->real_parent->children);
1288 tracehook_finish_clone(p, clone_flags, trace); 1294 tracehook_finish_clone(p, clone_flags, trace);
1289 1295
1290 if (thread_group_leader(p)) { 1296 if (thread_group_leader(p)) {
@@ -1296,6 +1302,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1296 p->signal->tty = tty_kref_get(current->signal->tty); 1302 p->signal->tty = tty_kref_get(current->signal->tty);
1297 attach_pid(p, PIDTYPE_PGID, task_pgrp(current)); 1303 attach_pid(p, PIDTYPE_PGID, task_pgrp(current));
1298 attach_pid(p, PIDTYPE_SID, task_session(current)); 1304 attach_pid(p, PIDTYPE_SID, task_session(current));
1305 list_add_tail(&p->sibling, &p->real_parent->children);
1299 list_add_tail_rcu(&p->tasks, &init_task.tasks); 1306 list_add_tail_rcu(&p->tasks, &init_task.tasks);
1300 __get_cpu_var(process_counts)++; 1307 __get_cpu_var(process_counts)++;
1301 } 1308 }
@@ -1315,7 +1322,8 @@ bad_fork_free_pid:
1315 if (pid != &init_struct_pid) 1322 if (pid != &init_struct_pid)
1316 free_pid(pid); 1323 free_pid(pid);
1317bad_fork_cleanup_io: 1324bad_fork_cleanup_io:
1318 put_io_context(p->io_context); 1325 if (p->io_context)
1326 exit_io_context(p);
1319bad_fork_cleanup_namespaces: 1327bad_fork_cleanup_namespaces:
1320 exit_task_namespaces(p); 1328 exit_task_namespaces(p);
1321bad_fork_cleanup_mm: 1329bad_fork_cleanup_mm: