Commit 1049c308 authored by Will Deacon's avatar Will Deacon

arm64: Pass user fault info to arm64_notify_die instead of printing it

There's no need for callers of arm64_notify_die to print information
about user faults. Instead, they can pass a string to arm64_notify_die
which will be printed subject to show_unhandled_signals.
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 15b67321
...@@ -582,8 +582,6 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs) ...@@ -582,8 +582,6 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs)
const struct fault_info *inf; const struct fault_info *inf;
inf = esr_to_fault_info(esr); inf = esr_to_fault_info(esr);
pr_err("Synchronous External Abort: %s (0x%08x) at 0x%016lx\n",
inf->name, esr, addr);
/* /*
* Synchronous aborts may interrupt code which had interrupts masked. * Synchronous aborts may interrupt code which had interrupts masked.
...@@ -607,7 +605,7 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs) ...@@ -607,7 +605,7 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs)
info.si_addr = NULL; info.si_addr = NULL;
else else
info.si_addr = (void __user *)addr; info.si_addr = (void __user *)addr;
arm64_notify_die("", regs, &info, esr); arm64_notify_die(inf->name, regs, &info, esr);
return 0; return 0;
} }
...@@ -698,19 +696,17 @@ asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr, ...@@ -698,19 +696,17 @@ asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr,
if (!inf->fn(addr, esr, regs)) if (!inf->fn(addr, esr, regs))
return; return;
pr_alert("Unhandled fault: %s at 0x%016lx\n", if (!user_mode(regs)) {
inf->name, addr); pr_alert("Unhandled fault at 0x%016lx\n", addr);
mem_abort_decode(esr);
mem_abort_decode(esr);
if (!user_mode(regs))
show_pte(addr); show_pte(addr);
}
info.si_signo = inf->sig; info.si_signo = inf->sig;
info.si_errno = 0; info.si_errno = 0;
info.si_code = inf->code; info.si_code = inf->code;
info.si_addr = (void __user *)addr; info.si_addr = (void __user *)addr;
arm64_notify_die("", regs, &info, esr); arm64_notify_die(inf->name, regs, &info, esr);
} }
asmlinkage void __exception do_el0_irq_bp_hardening(void) asmlinkage void __exception do_el0_irq_bp_hardening(void)
...@@ -741,7 +737,6 @@ asmlinkage void __exception do_sp_pc_abort(unsigned long addr, ...@@ -741,7 +737,6 @@ asmlinkage void __exception do_sp_pc_abort(unsigned long addr,
struct pt_regs *regs) struct pt_regs *regs)
{ {
struct siginfo info; struct siginfo info;
struct task_struct *tsk = current;
if (user_mode(regs)) { if (user_mode(regs)) {
if (instruction_pointer(regs) > TASK_SIZE) if (instruction_pointer(regs) > TASK_SIZE)
...@@ -749,17 +744,11 @@ asmlinkage void __exception do_sp_pc_abort(unsigned long addr, ...@@ -749,17 +744,11 @@ asmlinkage void __exception do_sp_pc_abort(unsigned long addr,
local_irq_enable(); local_irq_enable();
} }
if (show_unhandled_signals && unhandled_signal(tsk, SIGBUS))
pr_info_ratelimited("%s[%d]: %s exception: pc=%p sp=%p\n",
tsk->comm, task_pid_nr(tsk),
esr_get_class_string(esr), (void *)regs->pc,
(void *)regs->sp);
info.si_signo = SIGBUS; info.si_signo = SIGBUS;
info.si_errno = 0; info.si_errno = 0;
info.si_code = BUS_ADRALN; info.si_code = BUS_ADRALN;
info.si_addr = (void __user *)addr; info.si_addr = (void __user *)addr;
arm64_notify_die("Oops - SP/PC alignment exception", regs, &info, esr); arm64_notify_die("SP/PC alignment exception", regs, &info, esr);
} }
int __init early_brk64(unsigned long addr, unsigned int esr, int __init early_brk64(unsigned long addr, unsigned int esr,
...@@ -814,14 +803,11 @@ asmlinkage int __exception do_debug_exception(unsigned long addr, ...@@ -814,14 +803,11 @@ asmlinkage int __exception do_debug_exception(unsigned long addr,
if (!inf->fn(addr, esr, regs)) { if (!inf->fn(addr, esr, regs)) {
rv = 1; rv = 1;
} else { } else {
pr_alert("Unhandled debug exception: %s (0x%08x) at 0x%016lx\n",
inf->name, esr, addr);
info.si_signo = inf->sig; info.si_signo = inf->sig;
info.si_errno = 0; info.si_errno = 0;
info.si_code = inf->code; info.si_code = inf->code;
info.si_addr = (void __user *)addr; info.si_addr = (void __user *)addr;
arm64_notify_die("", regs, &info, 0); arm64_notify_die(inf->name, regs, &info, esr);
rv = 0; rv = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment