]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/process_64.c
Merge branch 'linus' into stackprotector
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / process_64.c
index 1cfd2a4bf853d4e04ac6a87a1e9aaa2213531f49..efb0396e19bf4bc8f9d90b7c913558bf0c6e2977 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <stdarg.h>
 
+#include <linux/stackprotector.h>
 #include <linux/cpu.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
@@ -53,6 +54,7 @@
 #include <asm/ia32.h>
 #include <asm/idle.h>
 #include <asm/syscalls.h>
+#include <asm/ds.h>
 
 asmlinkage extern void ret_from_fork(void);
 
@@ -110,6 +112,17 @@ static inline void play_dead(void)
 void cpu_idle(void)
 {
        current_thread_info()->status |= TS_POLLING;
+
+       /*
+        * If we're the non-boot CPU, nothing set the PDA stack
+        * canary up for us - and if we are the boot CPU we have
+        * a 0 stack canary. This is a good place for updating
+        * it, as we wont ever return from this function (so the
+        * invalid canaries already on the stack wont ever
+        * trigger):
+        */
+       boot_init_stack_canary();
+
        /* endless idle loop with no priority at all */
        while (1) {
                tick_nohz_stop_sched_tick(1);
@@ -236,17 +249,8 @@ void exit_thread(void)
                t->io_bitmap_max = 0;
                put_cpu();
        }
-#ifdef CONFIG_X86_DS
-       /* Free any BTS tracers that have not been properly released. */
-       if (unlikely(current->bts)) {
-               ds_release_bts(current->bts);
-               current->bts = NULL;
-
-               kfree(current->bts_buffer);
-               current->bts_buffer = NULL;
-               current->bts_size = 0;
-       }
-#endif /* CONFIG_X86_DS */
+
+       ds_exit_thread(current);
 }
 
 void flush_thread(void)
@@ -376,6 +380,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
                if (err)
                        goto out;
        }
+
+       ds_copy_thread(p, me);
+
+       clear_tsk_thread_flag(p, TIF_DEBUGCTLMSR);
+       p->thread.debugctlmsr = 0;
+
        err = 0;
 out:
        if (err && p->thread.io_bitmap_ptr) {
@@ -623,7 +633,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
                  (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