aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-01-19 22:29:19 -0500
committerTejun Heo <tj@kernel.org>2009-01-19 22:29:19 -0500
commitc6e50f93db5bd0895ec7c7d1b6f3886c6e1f11b6 (patch)
tree3d6b2d04118bb61fb50cf7624aaf7f7e4f5916ce
parent7890ba8c87604ca4c2c73f7de846bf5305d743e4 (diff)
x86: cleanup stack protector
Impact: cleanup Make the following cleanups. * remove duplicate comment from boot_init_stack_canary() which fits better in the other place - cpu_idle(). * move stack_canary offset check from __switch_to() to boot_init_stack_canary(). Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--arch/x86/include/asm/pda.h2
-rw-r--r--arch/x86/include/asm/stackprotector.h13
-rw-r--r--arch/x86/kernel/process_64.c7
3 files changed, 6 insertions, 16 deletions
diff --git a/arch/x86/include/asm/pda.h b/arch/x86/include/asm/pda.h
index 5976cd803e9a..4a8c9d382c93 100644
--- a/arch/x86/include/asm/pda.h
+++ b/arch/x86/include/asm/pda.h
@@ -40,6 +40,4 @@ extern void pda_init(int);
40 40
41#endif 41#endif
42 42
43#define refresh_stack_canary() write_pda(stack_canary, current->stack_canary)
44
45#endif /* _ASM_X86_PDA_H */ 43#endif /* _ASM_X86_PDA_H */
diff --git a/arch/x86/include/asm/stackprotector.h b/arch/x86/include/asm/stackprotector.h
index c7f0d10bae7b..2383e5bb475c 100644
--- a/arch/x86/include/asm/stackprotector.h
+++ b/arch/x86/include/asm/stackprotector.h
@@ -16,13 +16,12 @@ static __always_inline void boot_init_stack_canary(void)
16 u64 tsc; 16 u64 tsc;
17 17
18 /* 18 /*
19 * If we're the non-boot CPU, nothing set the PDA stack 19 * Build time only check to make sure the stack_canary is at
20 * canary up for us - and if we are the boot CPU we have 20 * offset 40 in the pda; this is a gcc ABI requirement
21 * a 0 stack canary. This is a good place for updating 21 */
22 * it, as we wont ever return from this function (so the 22 BUILD_BUG_ON(offsetof(struct x8664_pda, stack_canary) != 40);
23 * invalid canaries already on the stack wont ever 23
24 * trigger). 24 /*
25 *
26 * We both use the random pool and the current TSC as a source 25 * We both use the random pool and the current TSC as a source
27 * of randomness. The TSC only matters for very early init, 26 * of randomness. The TSC only matters for very early init,
28 * there it already has some randomness on most systems. Later 27 * there it already has some randomness on most systems. Later
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index aa89eabf09e0..088bc9a0f82c 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -638,13 +638,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
638 percpu_write(kernel_stack, 638 percpu_write(kernel_stack,
639 (unsigned long)task_stack_page(next_p) + 639 (unsigned long)task_stack_page(next_p) +
640 THREAD_SIZE - KERNEL_STACK_OFFSET); 640 THREAD_SIZE - KERNEL_STACK_OFFSET);
641#ifdef CONFIG_CC_STACKPROTECTOR
642 /*
643 * Build time only check to make sure the stack_canary is at
644 * offset 40 in the pda; this is a gcc ABI requirement
645 */
646 BUILD_BUG_ON(offsetof(struct x8664_pda, stack_canary) != 40);
647#endif
648 641
649 /* 642 /*
650 * Now maybe reload the debug registers and handle I/O bitmaps 643 * Now maybe reload the debug registers and handle I/O bitmaps