From f9ad3bc8a9afa39064845d97b5e435e65ec86b0d Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Thu, 14 Feb 2008 08:48:23 +0100 Subject: [PATCH] --- yaml --- r: 136345 b: refs/heads/master c: e00320875d0cc5f8099a7227b2f25fbb3231268d h: refs/heads/master i: 136343: 20f1721575c01f1b439cfda5242aba23b2e979be v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/process_64.c | 1 - trunk/include/asm-x86/pda.h | 2 -- trunk/include/asm-x86/system.h | 6 +++++- trunk/include/linux/sched.h | 3 +-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 0eb44ae26a34..03e934b61dae 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4c7f8900f1d8a0e464e7092f132a7e93f7c20f2f +refs/heads/master: e00320875d0cc5f8099a7227b2f25fbb3231268d diff --git a/trunk/arch/x86/kernel/process_64.c b/trunk/arch/x86/kernel/process_64.c index e2319f39988b..d8640388039e 100644 --- a/trunk/arch/x86/kernel/process_64.c +++ b/trunk/arch/x86/kernel/process_64.c @@ -640,7 +640,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) write_pda(kernelstack, (unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); #ifdef CONFIG_CC_STACKPROTECTOR - write_pda(stack_canary, next_p->stack_canary); /* * Build time only check to make sure the stack_canary is at * offset 40 in the pda; this is a gcc ABI requirement diff --git a/trunk/include/asm-x86/pda.h b/trunk/include/asm-x86/pda.h index 101fb9e11954..62b734986a44 100644 --- a/trunk/include/asm-x86/pda.h +++ b/trunk/include/asm-x86/pda.h @@ -16,11 +16,9 @@ struct x8664_pda { unsigned long oldrsp; /* 24 user rsp for system call */ int irqcount; /* 32 Irq nesting counter. Starts -1 */ unsigned int cpunumber; /* 36 Logical CPU number */ -#ifdef CONFIG_CC_STACKPROTECTOR unsigned long stack_canary; /* 40 stack canary value */ /* gcc-ABI: this canary MUST be at offset 40!!! */ -#endif char *irqstackptr; unsigned int __softirq_pending; unsigned int __nmi_count; /* number of NMI on this CPUs */ diff --git a/trunk/include/asm-x86/system.h b/trunk/include/asm-x86/system.h index a2f04cd79b29..172f54185093 100644 --- a/trunk/include/asm-x86/system.h +++ b/trunk/include/asm-x86/system.h @@ -92,6 +92,8 @@ do { \ ".globl thread_return\n" \ "thread_return:\n\t" \ "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ + "movq %P[task_canary](%%rsi),%%r8\n\t" \ + "movq %%r8,%%gs:%P[pda_canary]\n\t" \ "movq %P[thread_info](%%rsi),%%r8\n\t" \ LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ "movq %%rax,%%rdi\n\t" \ @@ -103,7 +105,9 @@ do { \ [ti_flags] "i" (offsetof(struct thread_info, flags)), \ [tif_fork] "i" (TIF_FORK), \ [thread_info] "i" (offsetof(struct task_struct, stack)), \ - [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ + [task_canary] "i" (offsetof(struct task_struct, stack_canary)),\ + [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)), \ + [pda_canary] "i" (offsetof(struct x8664_pda, stack_canary))\ : "memory", "cc" __EXTRA_CLOBBER) #endif diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index 5395a6176f4b..d6a515158783 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -1096,10 +1096,9 @@ struct task_struct { pid_t pid; pid_t tgid; -#ifdef CONFIG_CC_STACKPROTECTOR /* Canary value for the -fstack-protector gcc feature */ unsigned long stack_canary; -#endif + /* * pointers to (original) parent process, youngest child, younger sibling, * older sibling, respectively. (p->father can be replaced with