diff options
Diffstat (limited to 'arch/x86/kernel/process_64.c')
-rw-r--r-- | arch/x86/kernel/process_64.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 4523ff88a69d..c422eebb0c58 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <stdarg.h> | 17 | #include <stdarg.h> |
18 | 18 | ||
19 | #include <linux/stackprotector.h> | ||
19 | #include <linux/cpu.h> | 20 | #include <linux/cpu.h> |
20 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
@@ -46,7 +47,6 @@ | |||
46 | #include <asm/processor.h> | 47 | #include <asm/processor.h> |
47 | #include <asm/i387.h> | 48 | #include <asm/i387.h> |
48 | #include <asm/mmu_context.h> | 49 | #include <asm/mmu_context.h> |
49 | #include <asm/pda.h> | ||
50 | #include <asm/prctl.h> | 50 | #include <asm/prctl.h> |
51 | #include <asm/desc.h> | 51 | #include <asm/desc.h> |
52 | #include <asm/proto.h> | 52 | #include <asm/proto.h> |
@@ -117,6 +117,17 @@ static inline void play_dead(void) | |||
117 | void cpu_idle(void) | 117 | void cpu_idle(void) |
118 | { | 118 | { |
119 | current_thread_info()->status |= TS_POLLING; | 119 | current_thread_info()->status |= TS_POLLING; |
120 | |||
121 | /* | ||
122 | * If we're the non-boot CPU, nothing set the PDA stack | ||
123 | * canary up for us - and if we are the boot CPU we have | ||
124 | * a 0 stack canary. This is a good place for updating | ||
125 | * it, as we wont ever return from this function (so the | ||
126 | * invalid canaries already on the stack wont ever | ||
127 | * trigger): | ||
128 | */ | ||
129 | boot_init_stack_canary(); | ||
130 | |||
120 | /* endless idle loop with no priority at all */ | 131 | /* endless idle loop with no priority at all */ |
121 | while (1) { | 132 | while (1) { |
122 | tick_nohz_stop_sched_tick(1); | 133 | tick_nohz_stop_sched_tick(1); |
@@ -626,14 +637,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
626 | percpu_write(kernel_stack, | 637 | percpu_write(kernel_stack, |
627 | (unsigned long)task_stack_page(next_p) + | 638 | (unsigned long)task_stack_page(next_p) + |
628 | THREAD_SIZE - KERNEL_STACK_OFFSET); | 639 | THREAD_SIZE - KERNEL_STACK_OFFSET); |
629 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
630 | write_pda(stack_canary, next_p->stack_canary); | ||
631 | /* | ||
632 | * Build time only check to make sure the stack_canary is at | ||
633 | * offset 40 in the pda; this is a gcc ABI requirement | ||
634 | */ | ||
635 | BUILD_BUG_ON(offsetof(struct x8664_pda, stack_canary) != 40); | ||
636 | #endif | ||
637 | 640 | ||
638 | /* | 641 | /* |
639 | * Now maybe reload the debug registers and handle I/O bitmaps | 642 | * Now maybe reload the debug registers and handle I/O bitmaps |