|
@@ -294,11 +294,18 @@ int __weak arch_dup_task_struct(struct task_struct *dst,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+void set_task_stack_end_magic(struct task_struct *tsk)
|
|
|
+{
|
|
|
+ unsigned long *stackend;
|
|
|
+
|
|
|
+ stackend = end_of_stack(tsk);
|
|
|
+ *stackend = STACK_END_MAGIC; /* for overflow detection */
|
|
|
+}
|
|
|
+
|
|
|
static struct task_struct *dup_task_struct(struct task_struct *orig)
|
|
|
{
|
|
|
struct task_struct *tsk;
|
|
|
struct thread_info *ti;
|
|
|
- unsigned long *stackend;
|
|
|
int node = tsk_fork_get_node(orig);
|
|
|
int err;
|
|
|
|
|
@@ -328,8 +335,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
|
|
|
setup_thread_stack(tsk, orig);
|
|
|
clear_user_return_notifier(tsk);
|
|
|
clear_tsk_need_resched(tsk);
|
|
|
- stackend = end_of_stack(tsk);
|
|
|
- *stackend = STACK_END_MAGIC; /* for overflow detection */
|
|
|
+ set_task_stack_end_magic(tsk);
|
|
|
|
|
|
#ifdef CONFIG_CC_STACKPROTECTOR
|
|
|
tsk->stack_canary = get_random_int();
|