aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/process.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2006-01-14 16:20:57 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-14 21:27:08 -0500
commiteb33c190c2b633f0dfc98481ecf12f62a02c705e (patch)
treecb7ec1168d0c9d333adc0d33012c0aefd808e58e /arch/s390/kernel/process.c
parent7ffbc9da137ef475afd5e01f72e1ce1ce49668b1 (diff)
[PATCH] s390: show_task oops
The show_task function walks the kernel stack backchain of processes assuming that the processes are not running. Since this assumption is not correct walking the backchain can lead to an addressing exception and therefore to a kernel hang. So prevent the kernel hang (you still get incorrect results) verity that all read accesses are within the bounds of the kernel stack before performing them. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/s390/kernel/process.c')
-rw-r--r--arch/s390/kernel/process.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 2ff90a1a1056..008c74526fd3 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -58,10 +58,18 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
58 */ 58 */
59unsigned long thread_saved_pc(struct task_struct *tsk) 59unsigned long thread_saved_pc(struct task_struct *tsk)
60{ 60{
61 struct stack_frame *sf; 61 struct stack_frame *sf, *low, *high;
62 62
63 sf = (struct stack_frame *) tsk->thread.ksp; 63 if (!tsk || !task_stack_page(tsk))
64 sf = (struct stack_frame *) sf->back_chain; 64 return 0;
65 low = task_stack_page(tsk);
66 high = (struct stack_frame *) task_pt_regs(tsk);
67 sf = (struct stack_frame *) (tsk->thread.ksp & PSW_ADDR_INSN);
68 if (sf <= low || sf > high)
69 return 0;
70 sf = (struct stack_frame *) (sf->back_chain & PSW_ADDR_INSN);
71 if (sf <= low || sf > high)
72 return 0;
65 return sf->gprs[8]; 73 return sf->gprs[8];
66} 74}
67 75