diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-12 05:03:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-12 05:03:49 -0400 |
commit | c7498081a6f5d96c9f3243b6b5e020352903bfd2 (patch) | |
tree | f23d27a2c973d0b0542f84cdd0b39be5e4ba406d /arch/sparc64 | |
parent | c6ed413ddcfb66e9d3e1318060271391c7659dd3 (diff) |
sparc64: Fix recursion in stack overflow detection handling.
The calls down into prom_printf() when we detect an overflowed stack
can recurse again since the overflow stack will be "below" the current
kernel stack limit.
Prevent this by just returning straight if we are on the stack
overflow safe stack already.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/lib/mcount.S | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc64/lib/mcount.S index 7735a7a60533..734caf0cec09 100644 --- a/arch/sparc64/lib/mcount.S +++ b/arch/sparc64/lib/mcount.S | |||
@@ -48,12 +48,23 @@ mcount: | |||
48 | sub %g3, STACK_BIAS, %g3 | 48 | sub %g3, STACK_BIAS, %g3 |
49 | cmp %sp, %g3 | 49 | cmp %sp, %g3 |
50 | bg,pt %xcc, 1f | 50 | bg,pt %xcc, 1f |
51 | sethi %hi(panicstring), %g3 | 51 | nop |
52 | /* If we are already on ovstack, don't hop onto it | ||
53 | * again, we are already trying to output the stack overflow | ||
54 | * message. | ||
55 | */ | ||
52 | sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough | 56 | sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough |
53 | or %g7, %lo(ovstack), %g7 | 57 | or %g7, %lo(ovstack), %g7 |
54 | add %g7, OVSTACKSIZE, %g7 | 58 | add %g7, OVSTACKSIZE, %g3 |
59 | sub %g3, STACK_BIAS + 192, %g3 | ||
55 | sub %g7, STACK_BIAS, %g7 | 60 | sub %g7, STACK_BIAS, %g7 |
56 | mov %g7, %sp | 61 | cmp %sp, %g7 |
62 | blu,pn %xcc, 2f | ||
63 | cmp %sp, %g3 | ||
64 | bleu,pn %xcc, 1f | ||
65 | nop | ||
66 | 2: mov %g3, %sp | ||
67 | sethi %hi(panicstring), %g3 | ||
57 | call prom_printf | 68 | call prom_printf |
58 | or %g3, %lo(panicstring), %o0 | 69 | or %g3, %lo(panicstring), %o0 |
59 | call prom_halt | 70 | call prom_halt |