Skip to content

Commit 0f642d6

Browse files
mopsfeldermpe
authored andcommitted
powerpc/traps: Print VMA for unhandled signals
This adds VMA address in the message printed for unhandled signals, similarly to what other architectures, like x86, print. Before this patch, a page fault looked like: pandafault[61470]: unhandled signal 11 at 100007d0 nip 1000061c lr 7fff8d185100 code 2 After this patch, a page fault looks like: pandafault[6303]: segfault 11 at 100007d0 nip 1000061c lr 7fff93c55100 code 2 in pandafault[10000000+10000] Signed-off-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 49d8f20 commit 0f642d6

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

arch/powerpc/kernel/traps.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,19 @@ EXPORT_SYMBOL(__debugger_fault_handler);
9696
#define TM_DEBUG(x...) do { } while(0)
9797
#endif
9898

99+
static const char *signame(int signr)
100+
{
101+
switch (signr) {
102+
case SIGBUS: return "bus error";
103+
case SIGFPE: return "floating point exception";
104+
case SIGILL: return "illegal instruction";
105+
case SIGSEGV: return "segfault";
106+
case SIGTRAP: return "unhandled trap";
107+
}
108+
109+
return "unknown signal";
110+
}
111+
99112
/*
100113
* Trap & Exception support
101114
*/
@@ -317,9 +330,13 @@ static void show_signal_msg(int signr, struct pt_regs *regs, int code,
317330
if (!unhandled_signal(current, signr))
318331
return;
319332

320-
pr_info("%s[%d]: unhandled signal %d at %lx nip %lx lr %lx code %x\n",
321-
current->comm, current->pid, signr,
333+
pr_info("%s[%d]: %s (%d) at %lx nip %lx lr %lx code %x",
334+
current->comm, current->pid, signame(signr), signr,
322335
addr, regs->nip, regs->link, code);
336+
337+
print_vma_addr(KERN_CONT " in ", regs->nip);
338+
339+
pr_cont("\n");
323340
}
324341

325342
void _exception_pkey(int signr, struct pt_regs *regs, int code,

0 commit comments

Comments
 (0)