aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-02-14 03:42:02 -0500
committerThomas Gleixner <tglx@linutronix.de>2008-05-26 10:15:32 -0400
commit18aa8bb12dcb10adc3d7c9d69714d53667c0ab7f (patch)
tree2081f51b29106b05867c70ee71641ecc466147da /include
parent9b5609fd773e6ac0b1d6d6e1bf68f32cca64e06b (diff)
stackprotector: add boot_init_stack_canary()
add the boot_init_stack_canary() and make the secondary idle threads use it. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86/stackprotector.h20
-rw-r--r--include/linux/stackprotector.h4
2 files changed, 24 insertions, 0 deletions
diff --git a/include/asm-x86/stackprotector.h b/include/asm-x86/stackprotector.h
index dcac7a6bdba2..0f91f7a2688c 100644
--- a/include/asm-x86/stackprotector.h
+++ b/include/asm-x86/stackprotector.h
@@ -1,4 +1,24 @@
1#ifndef _ASM_STACKPROTECTOR_H 1#ifndef _ASM_STACKPROTECTOR_H
2#define _ASM_STACKPROTECTOR_H 1 2#define _ASM_STACKPROTECTOR_H 1
3 3
4/*
5 * Initialize the stackprotector canary value.
6 *
7 * NOTE: this must only be called from functions that never return,
8 * and it must always be inlined.
9 */
10static __always_inline void boot_init_stack_canary(void)
11{
12 /*
13 * If we're the non-boot CPU, nothing set the PDA stack
14 * canary up for us - and if we are the boot CPU we have
15 * a 0 stack canary. This is a good place for updating
16 * it, as we wont ever return from this function (so the
17 * invalid canaries already on the stack wont ever
18 * trigger):
19 */
20 current->stack_canary = get_random_int();
21 write_pda(stack_canary, current->stack_canary);
22}
23
4#endif 24#endif
diff --git a/include/linux/stackprotector.h b/include/linux/stackprotector.h
index d3e8bbe602f8..422e71aafd0b 100644
--- a/include/linux/stackprotector.h
+++ b/include/linux/stackprotector.h
@@ -3,6 +3,10 @@
3 3
4#ifdef CONFIG_CC_STACKPROTECTOR 4#ifdef CONFIG_CC_STACKPROTECTOR
5# include <asm/stackprotector.h> 5# include <asm/stackprotector.h>
6#else
7static inline void boot_init_stack_canary(void)
8{
9}
6#endif 10#endif
7 11
8#endif 12#endif