diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index a66fbde20715..6715ebc3761d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/proc_fs.h> | 61 | #include <linux/proc_fs.h> |
62 | #include <linux/blkdev.h> | 62 | #include <linux/blkdev.h> |
63 | #include <trace/sched.h> | 63 | #include <trace/sched.h> |
64 | #include <linux/magic.h> | ||
64 | 65 | ||
65 | #include <asm/pgtable.h> | 66 | #include <asm/pgtable.h> |
66 | #include <asm/pgalloc.h> | 67 | #include <asm/pgalloc.h> |
@@ -212,6 +213,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
212 | { | 213 | { |
213 | struct task_struct *tsk; | 214 | struct task_struct *tsk; |
214 | struct thread_info *ti; | 215 | struct thread_info *ti; |
216 | unsigned long *stackend; | ||
217 | |||
215 | int err; | 218 | int err; |
216 | 219 | ||
217 | prepare_to_copy(orig); | 220 | prepare_to_copy(orig); |
@@ -237,6 +240,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
237 | goto out; | 240 | goto out; |
238 | 241 | ||
239 | setup_thread_stack(tsk, orig); | 242 | setup_thread_stack(tsk, orig); |
243 | stackend = end_of_stack(tsk); | ||
244 | *stackend = STACK_END_MAGIC; /* for overflow detection */ | ||
240 | 245 | ||
241 | #ifdef CONFIG_CC_STACKPROTECTOR | 246 | #ifdef CONFIG_CC_STACKPROTECTOR |
242 | tsk->stack_canary = get_random_int(); | 247 | tsk->stack_canary = get_random_int(); |
@@ -1179,10 +1184,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1179 | #endif | 1184 | #endif |
1180 | clear_all_latency_tracing(p); | 1185 | clear_all_latency_tracing(p); |
1181 | 1186 | ||
1182 | /* Our parent execution domain becomes current domain | ||
1183 | These must match for thread signalling to apply */ | ||
1184 | p->parent_exec_id = p->self_exec_id; | ||
1185 | |||
1186 | /* ok, now we should be set up.. */ | 1187 | /* ok, now we should be set up.. */ |
1187 | p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL); | 1188 | p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL); |
1188 | p->pdeath_signal = 0; | 1189 | p->pdeath_signal = 0; |
@@ -1220,10 +1221,13 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1220 | set_task_cpu(p, smp_processor_id()); | 1221 | set_task_cpu(p, smp_processor_id()); |
1221 | 1222 | ||
1222 | /* CLONE_PARENT re-uses the old parent */ | 1223 | /* CLONE_PARENT re-uses the old parent */ |
1223 | if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) | 1224 | if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) { |
1224 | p->real_parent = current->real_parent; | 1225 | p->real_parent = current->real_parent; |
1225 | else | 1226 | p->parent_exec_id = current->parent_exec_id; |
1227 | } else { | ||
1226 | p->real_parent = current; | 1228 | p->real_parent = current; |
1229 | p->parent_exec_id = current->self_exec_id; | ||
1230 | } | ||
1227 | 1231 | ||
1228 | spin_lock(¤t->sighand->siglock); | 1232 | spin_lock(¤t->sighand->siglock); |
1229 | 1233 | ||