s390/fault: merge report_user_fault implementations
We have two close to identical report_user_fault functions. Add a parameter to one and get rid of the other one in order to reduce code duplication. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
ee8479bb97
commit
5d7eccecf8
|
@ -101,6 +101,8 @@ extern void pfault_fini(void);
|
|||
#define pfault_fini() do { } while (0)
|
||||
#endif /* CONFIG_PFAULT */
|
||||
|
||||
void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault);
|
||||
|
||||
extern void cmma_init(void);
|
||||
|
||||
extern void (*_machine_restart)(char *command);
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include <asm/fpu/api.h>
|
||||
#include "entry.h"
|
||||
|
||||
int show_unhandled_signals = 1;
|
||||
|
||||
static inline void __user *get_trap_ip(struct pt_regs *regs)
|
||||
{
|
||||
unsigned long address;
|
||||
|
@ -35,21 +33,6 @@ static inline void __user *get_trap_ip(struct pt_regs *regs)
|
|||
return (void __user *) (address - (regs->int_code >> 16));
|
||||
}
|
||||
|
||||
static inline void report_user_fault(struct pt_regs *regs, int signr)
|
||||
{
|
||||
if ((task_pid_nr(current) > 1) && !show_unhandled_signals)
|
||||
return;
|
||||
if (!unhandled_signal(current, signr))
|
||||
return;
|
||||
if (!printk_ratelimit())
|
||||
return;
|
||||
printk("User process fault: interruption code %04x ilc:%d ",
|
||||
regs->int_code & 0xffff, regs->int_code >> 17);
|
||||
print_vma_addr("in ", regs->psw.addr);
|
||||
printk("\n");
|
||||
show_regs(regs);
|
||||
}
|
||||
|
||||
int is_valid_bugaddr(unsigned long addr)
|
||||
{
|
||||
return 1;
|
||||
|
@ -65,7 +48,7 @@ void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str)
|
|||
info.si_code = si_code;
|
||||
info.si_addr = get_trap_ip(regs);
|
||||
force_sig_info(si_signo, &info, current);
|
||||
report_user_fault(regs, si_signo);
|
||||
report_user_fault(regs, si_signo, 0);
|
||||
} else {
|
||||
const struct exception_table_entry *fixup;
|
||||
fixup = search_exception_tables(regs->psw.addr);
|
||||
|
@ -111,7 +94,7 @@ NOKPROBE_SYMBOL(do_per_trap);
|
|||
void default_trap_handler(struct pt_regs *regs)
|
||||
{
|
||||
if (user_mode(regs)) {
|
||||
report_user_fault(regs, SIGSEGV);
|
||||
report_user_fault(regs, SIGSEGV, 0);
|
||||
do_exit(SIGSEGV);
|
||||
} else
|
||||
die(regs, "Unknown program exception");
|
||||
|
|
|
@ -183,6 +183,8 @@ static void dump_fault_info(struct pt_regs *regs)
|
|||
{
|
||||
unsigned long asce;
|
||||
|
||||
pr_alert("Failing address: %016lx TEID: %016lx\n",
|
||||
regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long);
|
||||
pr_alert("Fault in ");
|
||||
switch (regs->int_parm_long & 3) {
|
||||
case 3:
|
||||
|
@ -218,7 +220,9 @@ static void dump_fault_info(struct pt_regs *regs)
|
|||
dump_pagetable(asce, regs->int_parm_long & __FAIL_ADDR_MASK);
|
||||
}
|
||||
|
||||
static inline void report_user_fault(struct pt_regs *regs, long signr)
|
||||
int show_unhandled_signals = 1;
|
||||
|
||||
void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault)
|
||||
{
|
||||
if ((task_pid_nr(current) > 1) && !show_unhandled_signals)
|
||||
return;
|
||||
|
@ -230,9 +234,8 @@ static inline void report_user_fault(struct pt_regs *regs, long signr)
|
|||
regs->int_code & 0xffff, regs->int_code >> 17);
|
||||
print_vma_addr(KERN_CONT "in ", regs->psw.addr);
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_ALERT "failing address: %016lx TEID: %016lx\n",
|
||||
regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long);
|
||||
dump_fault_info(regs);
|
||||
if (is_mm_fault)
|
||||
dump_fault_info(regs);
|
||||
show_regs(regs);
|
||||
}
|
||||
|
||||
|
@ -244,7 +247,7 @@ static noinline void do_sigsegv(struct pt_regs *regs, int si_code)
|
|||
{
|
||||
struct siginfo si;
|
||||
|
||||
report_user_fault(regs, SIGSEGV);
|
||||
report_user_fault(regs, SIGSEGV, 1);
|
||||
si.si_signo = SIGSEGV;
|
||||
si.si_code = si_code;
|
||||
si.si_addr = (void __user *)(regs->int_parm_long & __FAIL_ADDR_MASK);
|
||||
|
@ -272,8 +275,6 @@ static noinline void do_no_context(struct pt_regs *regs)
|
|||
else
|
||||
printk(KERN_ALERT "Unable to handle kernel paging request"
|
||||
" in virtual user address space\n");
|
||||
printk(KERN_ALERT "failing address: %016lx TEID: %016lx\n",
|
||||
regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long);
|
||||
dump_fault_info(regs);
|
||||
die(regs, "Oops");
|
||||
do_exit(SIGKILL);
|
||||
|
|
Loading…
Reference in New Issue