aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/traps.c
diff options
context:
space:
mode:
authorRohit Thapliyal <r.thapliyal@samsung.com>2015-07-10 04:23:59 -0400
committerWill Deacon <will.deacon@arm.com>2015-07-27 06:08:38 -0400
commite147ae6d7f908412a013c115e42c3e15dac33ccc (patch)
tree8b44d24fae0070710225abb74cbb26cd701db689 /arch/arm64/kernel/traps.c
parentd09ce834dfffd93aa4586b3e07faaf901ee8706f (diff)
arm64: modify the dump mem for 64 bit addresses
On 64bit kernel, the dump_mem gives 32 bit addresses on the stack dump. This gives unorganized information regarding the 64bit values on the stack. Hence, modified to get a complete 64bit memory dump. With patch: [ 93.534801] Process insmod (pid: 1587, stack limit = 0xffffffc976be4058) [ 93.541441] Stack: (0xffffffc976be7cf0 to 0xffffffc976be8000) [ 93.547136] 7ce0: ffffffc976be7d00 ffffffc00008163c [ 93.554898] 7d00: ffffffc976be7d40 ffffffc0000f8a44 ffffffc00098ef38 ffffffbffc000088 [ 93.562659] 7d20: ffffffc00098ef50 ffffffbffc0000c0 0000000000000001 ffffffbffc000070 [ 93.570419] 7d40: ffffffc976be7e40 ffffffc0000f935c 0000000000000000 000000002b424090 [ 93.578179] 7d60: 000000002b424010 0000007facc555f4 0000000080000000 0000000000000015 [ 93.585937] 7d80: 0000000000000116 0000000000000069 ffffffc00097b000 ffffffc976be4000 [ 93.593694] 7da0: 0000000000000064 0000000000000072 000000000000006e 000000000000003f [ 93.601453] 7dc0: 000000000000feff 000000000000fff1 ffffffbffc002028 0000000000000124 [ 93.609211] 7de0: ffffffc976be7e10 0000000000000001 ffffff8000000000 ffffffbbffff0000 [ 93.616969] 7e00: ffffffc976be7e60 0000000000000000 0000000000000000 0000000000000000 [ 93.624726] 7e20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 [ 93.632484] 7e40: 0000007fcc474550 ffffffc0000841ec 000000002b424010 0000007facda0710 [ 93.640241] 7e60: ffffffffffffffff ffffffc0000be6dc ffffff80007d2000 000000000001c010 [ 93.647999] 7e80: ffffff80007e0ae0 ffffff80007e09d0 ffffff80007edf70 0000000000000288 [ 93.655757] 7ea0: 00000000000002e8 0000000000000000 0000000000000000 0000001c0000001b [ 93.663514] 7ec0: 0000000000000009 0000000000000007 000000002b424090 000000000001c010 [ 93.671272] 7ee0: 000000002b424010 0000007faccd3a48 0000000000000000 0000000000000000 [ 93.679030] 7f00: 0000007fcc4743f8 0000007fcc4743f8 0000000000000069 0000000000000003 [ 93.686787] 7f20: 0101010101010101 0000000000000004 0000000000000020 00000000000003f3 [ 93.694544] 7f40: 0000007facb95664 0000007facda7030 0000007facc555d0 0000000000498378 [ 93.702301] 7f60: 0000000000000000 000000002b424010 0000007facda0710 000000002b424090 [ 93.710058] 7f80: 0000007fcc474698 0000000000498000 0000007fcc474ebb 0000000000474f58 [ 93.717815] 7fa0: 0000000000498000 0000000000000000 0000000000000000 0000007fcc474550 [ 93.725573] 7fc0: 00000000004104bc 0000007fcc474430 0000007facc555f4 0000000080000000 [ 93.733330] 7fe0: 000000002b424090 0000000000000069 0950020128000244 4104000008000004 [ 93.741084] Call trace: The above output makes a debugger life a lot more easier. Signed-off-by: Rohit Thapliyal <r.thapliyal@samsung.com> Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/traps.c')
-rw-r--r--arch/arm64/kernel/traps.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 566bc4c35040..4db6a2574fec 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -52,11 +52,12 @@ int show_unhandled_signals = 1;
52 * Dump out the contents of some memory nicely... 52 * Dump out the contents of some memory nicely...
53 */ 53 */
54static void dump_mem(const char *lvl, const char *str, unsigned long bottom, 54static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
55 unsigned long top) 55 unsigned long top, bool compat)
56{ 56{
57 unsigned long first; 57 unsigned long first;
58 mm_segment_t fs; 58 mm_segment_t fs;
59 int i; 59 int i;
60 unsigned int width = compat ? 4 : 8;
60 61
61 /* 62 /*
62 * We need to switch to kernel mode so that we can use __get_user 63 * We need to switch to kernel mode so that we can use __get_user
@@ -75,13 +76,22 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
75 memset(str, ' ', sizeof(str)); 76 memset(str, ' ', sizeof(str));
76 str[sizeof(str) - 1] = '\0'; 77 str[sizeof(str) - 1] = '\0';
77 78
78 for (p = first, i = 0; i < 8 && p < top; i++, p += 4) { 79 for (p = first, i = 0; i < (32 / width)
80 && p < top; i++, p += width) {
79 if (p >= bottom && p < top) { 81 if (p >= bottom && p < top) {
80 unsigned int val; 82 unsigned long val;
81 if (__get_user(val, (unsigned int *)p) == 0) 83
82 sprintf(str + i * 9, " %08x", val); 84 if (width == 8) {
83 else 85 if (__get_user(val, (unsigned long *)p) == 0)
84 sprintf(str + i * 9, " ????????"); 86 sprintf(str + i * 17, " %016lx", val);
87 else
88 sprintf(str + i * 17, " ????????????????");
89 } else {
90 if (__get_user(val, (unsigned int *)p) == 0)
91 sprintf(str + i * 9, " %08lx", val);
92 else
93 sprintf(str + i * 9, " ????????");
94 }
85 } 95 }
86 } 96 }
87 printk("%s%04lx:%s\n", lvl, first & 0xffff, str); 97 printk("%s%04lx:%s\n", lvl, first & 0xffff, str);
@@ -95,7 +105,7 @@ static void dump_backtrace_entry(unsigned long where, unsigned long stack)
95 print_ip_sym(where); 105 print_ip_sym(where);
96 if (in_exception_text(where)) 106 if (in_exception_text(where))
97 dump_mem("", "Exception stack", stack, 107 dump_mem("", "Exception stack", stack,
98 stack + sizeof(struct pt_regs)); 108 stack + sizeof(struct pt_regs), false);
99} 109}
100 110
101static void dump_instr(const char *lvl, struct pt_regs *regs) 111static void dump_instr(const char *lvl, struct pt_regs *regs)
@@ -207,7 +217,8 @@ static int __die(const char *str, int err, struct thread_info *thread,
207 217
208 if (!user_mode(regs) || in_interrupt()) { 218 if (!user_mode(regs) || in_interrupt()) {
209 dump_mem(KERN_EMERG, "Stack: ", regs->sp, 219 dump_mem(KERN_EMERG, "Stack: ", regs->sp,
210 THREAD_SIZE + (unsigned long)task_stack_page(tsk)); 220 THREAD_SIZE + (unsigned long)task_stack_page(tsk),
221 compat_user_mode(regs));
211 dump_backtrace(regs, tsk); 222 dump_backtrace(regs, tsk);
212 dump_instr(KERN_EMERG, regs); 223 dump_instr(KERN_EMERG, regs);
213 } 224 }