diff options
-rw-r--r-- | arch/x86/kernel/process_64.c | 1 | ||||
-rw-r--r-- | include/asm-x86/pda.h | 2 | ||||
-rw-r--r-- | include/asm-x86/system.h | 6 | ||||
-rw-r--r-- | include/linux/sched.h | 3 |
4 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index e2319f39988b..d8640388039e 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -640,7 +640,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
640 | write_pda(kernelstack, | 640 | write_pda(kernelstack, |
641 | (unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); | 641 | (unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); |
642 | #ifdef CONFIG_CC_STACKPROTECTOR | 642 | #ifdef CONFIG_CC_STACKPROTECTOR |
643 | write_pda(stack_canary, next_p->stack_canary); | ||
644 | /* | 643 | /* |
645 | * Build time only check to make sure the stack_canary is at | 644 | * Build time only check to make sure the stack_canary is at |
646 | * offset 40 in the pda; this is a gcc ABI requirement | 645 | * offset 40 in the pda; this is a gcc ABI requirement |
diff --git a/include/asm-x86/pda.h b/include/asm-x86/pda.h index 101fb9e11954..62b734986a44 100644 --- a/include/asm-x86/pda.h +++ b/include/asm-x86/pda.h | |||
@@ -16,11 +16,9 @@ struct x8664_pda { | |||
16 | unsigned long oldrsp; /* 24 user rsp for system call */ | 16 | unsigned long oldrsp; /* 24 user rsp for system call */ |
17 | int irqcount; /* 32 Irq nesting counter. Starts -1 */ | 17 | int irqcount; /* 32 Irq nesting counter. Starts -1 */ |
18 | unsigned int cpunumber; /* 36 Logical CPU number */ | 18 | unsigned int cpunumber; /* 36 Logical CPU number */ |
19 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
20 | unsigned long stack_canary; /* 40 stack canary value */ | 19 | unsigned long stack_canary; /* 40 stack canary value */ |
21 | /* gcc-ABI: this canary MUST be at | 20 | /* gcc-ABI: this canary MUST be at |
22 | offset 40!!! */ | 21 | offset 40!!! */ |
23 | #endif | ||
24 | char *irqstackptr; | 22 | char *irqstackptr; |
25 | unsigned int __softirq_pending; | 23 | unsigned int __softirq_pending; |
26 | unsigned int __nmi_count; /* number of NMI on this CPUs */ | 24 | unsigned int __nmi_count; /* number of NMI on this CPUs */ |
diff --git a/include/asm-x86/system.h b/include/asm-x86/system.h index a2f04cd79b29..172f54185093 100644 --- a/include/asm-x86/system.h +++ b/include/asm-x86/system.h | |||
@@ -92,6 +92,8 @@ do { \ | |||
92 | ".globl thread_return\n" \ | 92 | ".globl thread_return\n" \ |
93 | "thread_return:\n\t" \ | 93 | "thread_return:\n\t" \ |
94 | "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ | 94 | "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ |
95 | "movq %P[task_canary](%%rsi),%%r8\n\t" \ | ||
96 | "movq %%r8,%%gs:%P[pda_canary]\n\t" \ | ||
95 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ | 97 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ |
96 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ | 98 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ |
97 | "movq %%rax,%%rdi\n\t" \ | 99 | "movq %%rax,%%rdi\n\t" \ |
@@ -103,7 +105,9 @@ do { \ | |||
103 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ | 105 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ |
104 | [tif_fork] "i" (TIF_FORK), \ | 106 | [tif_fork] "i" (TIF_FORK), \ |
105 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ | 107 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ |
106 | [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ | 108 | [task_canary] "i" (offsetof(struct task_struct, stack_canary)),\ |
109 | [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)), \ | ||
110 | [pda_canary] "i" (offsetof(struct x8664_pda, stack_canary))\ | ||
107 | : "memory", "cc" __EXTRA_CLOBBER) | 111 | : "memory", "cc" __EXTRA_CLOBBER) |
108 | #endif | 112 | #endif |
109 | 113 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5395a6176f4b..d6a515158783 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1096,10 +1096,9 @@ struct task_struct { | |||
1096 | pid_t pid; | 1096 | pid_t pid; |
1097 | pid_t tgid; | 1097 | pid_t tgid; |
1098 | 1098 | ||
1099 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
1100 | /* Canary value for the -fstack-protector gcc feature */ | 1099 | /* Canary value for the -fstack-protector gcc feature */ |
1101 | unsigned long stack_canary; | 1100 | unsigned long stack_canary; |
1102 | #endif | 1101 | |
1103 | /* | 1102 | /* |
1104 | * pointers to (original) parent process, youngest child, younger sibling, | 1103 | * pointers to (original) parent process, youngest child, younger sibling, |
1105 | * older sibling, respectively. (p->father can be replaced with | 1104 | * older sibling, respectively. (p->father can be replaced with |