Commit 3243d874 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[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: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 595f403c
...@@ -487,9 +487,12 @@ static void __init emergency_stack_init(void) ...@@ -487,9 +487,12 @@ static void __init emergency_stack_init(void)
*/ */
limit = min(0x10000000UL, lmb.rmo_size); limit = min(0x10000000UL, lmb.rmo_size);
for_each_possible_cpu(i) for_each_possible_cpu(i) {
paca[i].emergency_sp = unsigned long sp;
__va(lmb_alloc_base(HW_PAGE_SIZE, 128, limit)) + HW_PAGE_SIZE; sp = lmb_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
sp += THREAD_SIZE;
paca[i].emergency_sp = __va(sp);
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment