提交 a0cab656 编写于 作者: R Robin Getz 提交者: Mike Frysinger

Blackfin: make sure stack is accessible before dumping it

When displaying a crash dump, make sure accessing the stack is safe so
we don't crash at the same time.
Signed-off-by: NRobin Getz <robin.getz@analog.com>
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
上级 b9a3899d
...@@ -196,6 +196,11 @@ static void decode_address(char *buf, unsigned long address) ...@@ -196,6 +196,11 @@ static void decode_address(char *buf, unsigned long address)
asmlinkage void double_fault_c(struct pt_regs *fp) asmlinkage void double_fault_c(struct pt_regs *fp)
{ {
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
int j;
trace_buffer_save(j);
#endif
console_verbose(); console_verbose();
oops_in_progress = 1; oops_in_progress = 1;
#ifdef CONFIG_DEBUG_VERBOSE #ifdef CONFIG_DEBUG_VERBOSE
...@@ -220,6 +225,7 @@ asmlinkage void double_fault_c(struct pt_regs *fp) ...@@ -220,6 +225,7 @@ asmlinkage void double_fault_c(struct pt_regs *fp)
dump_bfin_process(fp); dump_bfin_process(fp);
dump_bfin_mem(fp); dump_bfin_mem(fp);
show_regs(fp); show_regs(fp);
dump_bfin_trace_buffer();
} }
#endif #endif
panic("Double Fault - unrecoverable event"); panic("Double Fault - unrecoverable event");
...@@ -832,6 +838,11 @@ void show_stack(struct task_struct *task, unsigned long *stack) ...@@ -832,6 +838,11 @@ void show_stack(struct task_struct *task, unsigned long *stack)
decode_address(buf, (unsigned int)stack); decode_address(buf, (unsigned int)stack);
printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf); printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf);
if (!access_ok(VERIFY_READ, stack, (unsigned int)endstack - (unsigned int)stack)) {
printk(KERN_NOTICE "Invalid stack pointer\n");
return;
}
/* First thing is to look for a frame pointer */ /* First thing is to look for a frame pointer */
for (addr = (unsigned int *)((unsigned int)stack & ~0xF); addr < endstack; addr++) { for (addr = (unsigned int *)((unsigned int)stack & ~0xF); addr < endstack; addr++) {
if (*addr & 0x1) if (*addr & 0x1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册