From: Michael Ellerman Date: Wed, 30 Apr 2008 03:21:45 +0000 (+1000) Subject: [POWERPC] Make emergency stack safe for current_thread_info() use X-Git-Tag: v3.12-rc1~20805^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3243d87441bf7f97c5c9f7dd46b35f5783ec6740;p=kernel%2Fkernel-generic.git [POWERPC] Make emergency stack safe for current_thread_info() use The current_thread_info() macro, used by preempt_count(), assumes the base address and size of the stack are THREAD_SIZE aligned. The emergency stack currently isn't either of these things, which could potentially cause problems anytime we're running on the emergency stack. That includes when we detect a bad kernel stack pointer, and also during early_setup_secondary(). Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index dff6308..25e3fd8 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -487,9 +487,12 @@ static void __init emergency_stack_init(void) */ limit = min(0x10000000UL, lmb.rmo_size); - for_each_possible_cpu(i) - paca[i].emergency_sp = - __va(lmb_alloc_base(HW_PAGE_SIZE, 128, limit)) + HW_PAGE_SIZE; + for_each_possible_cpu(i) { + unsigned long sp; + sp = lmb_alloc_base(THREAD_SIZE, THREAD_SIZE, limit); + sp += THREAD_SIZE; + paca[i].emergency_sp = __va(sp); + } } /*