]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/process_64.c
x86: setup stack canary for the idle threads
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / process_64.c
index e2319f39988b042f364a73174a0d2ac254a5b60d..9e69e223023e21e14e60c57799d4417ac13c2f98 100644 (file)
@@ -146,6 +146,15 @@ static inline void play_dead(void)
 void cpu_idle(void)
 {
        current_thread_info()->status |= TS_POLLING;
+
+#ifdef CONFIG_CC_STACKPROTECTOR
+       /*
+        * If we're the non-boot CPU, nothing set the PDA stack
+        * canary up for us. This is as good a place as any for
+        * doing that.
+        */
+       write_pda(stack_canary, current->stack_canary);
+#endif
        /* endless idle loop with no priority at all */
        while (1) {
                tick_nohz_stop_sched_tick();
@@ -640,7 +649,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
        write_pda(kernelstack,
        (unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
 #ifdef CONFIG_CC_STACKPROTECTOR
-       write_pda(stack_canary, next_p->stack_canary);
        /*
         * Build time only check to make sure the stack_canary is at
         * offset 40 in the pda; this is a gcc ABI requirement