Skip to content

Commit

Permalink
[POWERPC] Make emergency stack safe for current_thread_info() use
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
  • Loading branch information
mpe authored and paulusmack committed Apr 30, 2008
1 parent 595f403 commit 3243d87
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions arch/powerpc/kernel/setup_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/*
Expand Down

0 comments on commit 3243d87

Please sign in to comment.