init/main.c: Give init_task a canary
[deliverable/linux.git] / kernel / fork.c
index 9387ae8ab048114fda9fb505dbbf97fea1312ed9..ad64248c4b18fe2ddf61921f9d585fad4561e96c 100644 (file)
@@ -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();
This page took 0.024245 seconds and 5 git commands to generate.