diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2008-04-29 23:21:45 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-30 05:49:48 -0400 |
commit | 3243d87441bf7f97c5c9f7dd46b35f5783ec6740 (patch) | |
tree | 7765277523d0146bccb5bde64df67b13723211a9 /arch/powerpc/kernel/setup_64.c | |
parent | 595f403c1af37b1339e64b89040528b8cd48c5a3 (diff) |
[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 <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/setup_64.c')
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index dff6308d1b5e..25e3fd8606ab 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) | |||
487 | */ | 487 | */ |
488 | limit = min(0x10000000UL, lmb.rmo_size); | 488 | limit = min(0x10000000UL, lmb.rmo_size); |
489 | 489 | ||
490 | for_each_possible_cpu(i) | 490 | for_each_possible_cpu(i) { |
491 | paca[i].emergency_sp = | 491 | unsigned long sp; |
492 | __va(lmb_alloc_base(HW_PAGE_SIZE, 128, limit)) + HW_PAGE_SIZE; | 492 | sp = lmb_alloc_base(THREAD_SIZE, THREAD_SIZE, limit); |
493 | sp += THREAD_SIZE; | ||
494 | paca[i].emergency_sp = __va(sp); | ||
495 | } | ||
493 | } | 496 | } |
494 | 497 | ||
495 | /* | 498 | /* |