[PATCH/RFC] arm: Enable backtrace printing on oops when PC is corrupted

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Jan 21 04:23:29 EST 2010


If PC points outside kernel text, start printing the backtrace at LR
instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 arch/arm/kernel/unwind.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index 786ac2b..50292cd 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -359,7 +359,9 @@ void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk)
 		frame.fp = regs->ARM_fp;
 		frame.sp = regs->ARM_sp;
 		frame.lr = regs->ARM_lr;
-		frame.pc = regs->ARM_pc;
+		/* PC might be corrupted, use LR in that case. */
+		frame.pc = kernel_text_address(regs->ARM_pc)
+			 ? regs->ARM_pc : regs->ARM_lr;
 	} else if (tsk == current) {
 		frame.fp = (unsigned long)__builtin_frame_address(0);
 		frame.sp = current_sp;
-- 
1.6.4.4




More information about the linux-arm-kernel mailing list