33 #ifndef _ASM_STACKPROTECTOR_H
34 #define _ASM_STACKPROTECTOR_H 1
36 #ifdef CONFIG_CC_STACKPROTECTOR
39 #include <asm/processor.h>
40 #include <asm/percpu.h>
42 #include <linux/random.h>
49 #define GDT_STACK_CANARY_INIT \
50 [GDT_ENTRY_STACK_CANARY] = GDT_ENTRY_INIT(0x4090, 0, 0x18),
73 tsc = __native_read_tsc();
74 canary += tsc + (tsc << 32
UL);
84 static inline void setup_stack_canary_segment(
int cpu)
87 unsigned long canary = (
unsigned long)&
per_cpu(stack_canary, cpu);
88 struct desc_struct *gdt_table = get_cpu_gdt_table(cpu);
91 desc = gdt_table[GDT_ENTRY_STACK_CANARY];
92 set_desc_base(&desc, canary);
97 static inline void load_stack_canary_segment(
void)
100 asm(
"mov %0, %%gs" : :
"r" (__KERNEL_STACK_CANARY) :
"memory");
106 #define GDT_STACK_CANARY_INIT
110 static inline void setup_stack_canary_segment(
int cpu)
113 static inline void load_stack_canary_segment(
void)
116 asm volatile (
"mov %0, %%gs" : :
"r" (0));