Loading arch/s390/kernel/traps.c +25 −54 Original line number Diff line number Diff line Loading @@ -9,10 +9,6 @@ * Copyright (C) 1991, 1992 Linus Torvalds */ /* * 'Traps.c' handles hardware traps and faults after we have saved some * state in 'asm.s'. */ #include <linux/cpufeature.h> #include <linux/kprobes.h> #include <linux/kdebug.h> Loading Loading @@ -66,8 +62,7 @@ void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str) static void do_trap(struct pt_regs *regs, int si_signo, int si_code, char *str) { if (notify_die(DIE_TRAP, str, regs, 0, regs->int_code, si_signo) == NOTIFY_STOP) if (notify_die(DIE_TRAP, str, regs, 0, regs->int_code, si_signo) == NOTIFY_STOP) return; do_report_trap(regs, si_signo, si_code, str); } Loading @@ -79,8 +74,7 @@ void do_per_trap(struct pt_regs *regs) return; if (!current->ptrace) return; force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __force __user *) current->thread.per_event.address); force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __force __user *)current->thread.per_event.address); } NOKPROBE_SYMBOL(do_per_trap); Loading @@ -99,36 +93,25 @@ static void name(struct pt_regs *regs) \ do_trap(regs, signr, sicode, str); \ } DO_ERROR_INFO(addressing_exception, SIGILL, ILL_ILLADR, "addressing exception") DO_ERROR_INFO(execute_exception, SIGILL, ILL_ILLOPN, "execute exception") DO_ERROR_INFO(divide_exception, SIGFPE, FPE_INTDIV, "fixpoint divide exception") DO_ERROR_INFO(overflow_exception, SIGFPE, FPE_INTOVF, "fixpoint overflow exception") DO_ERROR_INFO(hfp_overflow_exception, SIGFPE, FPE_FLTOVF, "HFP overflow exception") DO_ERROR_INFO(hfp_underflow_exception, SIGFPE, FPE_FLTUND, "HFP underflow exception") DO_ERROR_INFO(hfp_significance_exception, SIGFPE, FPE_FLTRES, "HFP significance exception") DO_ERROR_INFO(hfp_divide_exception, SIGFPE, FPE_FLTDIV, "HFP divide exception") DO_ERROR_INFO(hfp_sqrt_exception, SIGFPE, FPE_FLTINV, "HFP square root exception") DO_ERROR_INFO(operand_exception, SIGILL, ILL_ILLOPN, "operand exception") DO_ERROR_INFO(privileged_op, SIGILL, ILL_PRVOPC, "privileged operation") DO_ERROR_INFO(special_op_exception, SIGILL, ILL_ILLOPN, "special operation exception") DO_ERROR_INFO(transaction_exception, SIGILL, ILL_ILLOPN, "transaction constraint exception") DO_ERROR_INFO(addressing_exception, SIGILL, ILL_ILLADR, "addressing exception") DO_ERROR_INFO(divide_exception, SIGFPE, FPE_INTDIV, "fixpoint divide exception") DO_ERROR_INFO(execute_exception, SIGILL, ILL_ILLOPN, "execute exception") DO_ERROR_INFO(hfp_divide_exception, SIGFPE, FPE_FLTDIV, "HFP divide exception") DO_ERROR_INFO(hfp_overflow_exception, SIGFPE, FPE_FLTOVF, "HFP overflow exception") DO_ERROR_INFO(hfp_significance_exception, SIGFPE, FPE_FLTRES, "HFP significance exception") DO_ERROR_INFO(hfp_sqrt_exception, SIGFPE, FPE_FLTINV, "HFP square root exception") DO_ERROR_INFO(hfp_underflow_exception, SIGFPE, FPE_FLTUND, "HFP underflow exception") DO_ERROR_INFO(operand_exception, SIGILL, ILL_ILLOPN, "operand exception") DO_ERROR_INFO(overflow_exception, SIGFPE, FPE_INTOVF, "fixpoint overflow exception") DO_ERROR_INFO(privileged_op, SIGILL, ILL_PRVOPC, "privileged operation") DO_ERROR_INFO(special_op_exception, SIGILL, ILL_ILLOPN, "special operation exception") DO_ERROR_INFO(specification_exception, SIGILL, ILL_ILLOPN, "specification exception"); DO_ERROR_INFO(transaction_exception, SIGILL, ILL_ILLOPN, "transaction constraint exception") static inline void do_fp_trap(struct pt_regs *regs, __u32 fpc) { int si_code = 0; /* FPC[2] is Data Exception Code */ if ((fpc & 0x00000300) == 0) { /* bits 6 and 7 of DXC are 0 iff IEEE exception */ Loading Loading @@ -160,7 +143,6 @@ static void illegal_op(struct pt_regs *regs) u16 opcode; location = get_trap_ip(regs); if (user_mode(regs)) { if (get_user(opcode, location)) return; Loading @@ -173,17 +155,17 @@ static void illegal_op(struct pt_regs *regs) } else if (opcode == UPROBE_SWBP_INSN) { is_uprobe_insn = 1; #endif } else } else { signal = SIGILL; } } /* * We got either an illegal op in kernel mode, or user space trapped * This is either an illegal op in kernel mode, or user space trapped * on a uprobes illegal instruction. See if kprobes or uprobes picks * it up. If not, SIGILL. */ if (is_uprobe_insn || !user_mode(regs)) { if (notify_die(DIE_BPT, "bpt", regs, 0, 3, SIGTRAP) != NOTIFY_STOP) if (notify_die(DIE_BPT, "bpt", regs, 0, 3, SIGTRAP) != NOTIFY_STOP) signal = SIGILL; } if (signal) Loading @@ -191,9 +173,6 @@ static void illegal_op(struct pt_regs *regs) } NOKPROBE_SYMBOL(illegal_op); DO_ERROR_INFO(specification_exception, SIGILL, ILL_ILLOPN, "specification exception"); static void vector_exception(struct pt_regs *regs) { int si_code, vic; Loading Loading @@ -245,7 +224,6 @@ static void monitor_event_exception(struct pt_regs *regs) { if (user_mode(regs)) return; switch (report_bug(regs->psw.addr - (regs->int_code >> 16), regs)) { case BUG_TRAP_TYPE_NONE: fixup_exception(regs); Loading Loading @@ -319,7 +297,6 @@ void noinstr __do_pgm_check(struct pt_regs *regs) teid.val = lc->trans_exc_code; regs->int_code = lc->pgm_int_code; regs->int_parm_long = teid.val; /* * In case of a guest fault, short-circuit the fault handler and return. * This way the sie64a() function will return 0; fault address and Loading @@ -332,9 +309,7 @@ void noinstr __do_pgm_check(struct pt_regs *regs) current->thread.gmap_int_code = regs->int_code & 0xffff; return; } state = irqentry_enter(regs); if (user_mode(regs)) { update_timer_sys(); if (!cpu_has_bear()) { Loading @@ -343,12 +318,10 @@ void noinstr __do_pgm_check(struct pt_regs *regs) } current->thread.last_break = regs->last_break; } if (lc->pgm_code & 0x0200) { /* transaction abort */ current->thread.trap_tdb = lc->pgm_tdb; } if (lc->pgm_code & PGM_INT_CODE_PER) { if (user_mode(regs)) { struct per_event *ev = ¤t->thread.per_event; Loading @@ -364,11 +337,9 @@ void noinstr __do_pgm_check(struct pt_regs *regs) goto out; } } if (!irqs_disabled_flags(regs->psw.mask)) trace_hardirqs_on(); __arch_local_irq_ssm(regs->psw.mask & ~PSW_MASK_PER); trapnr = regs->int_code & PGM_INT_CODE_MASK; if (trapnr) pgm_check_table[trapnr](regs); Loading Loading
arch/s390/kernel/traps.c +25 −54 Original line number Diff line number Diff line Loading @@ -9,10 +9,6 @@ * Copyright (C) 1991, 1992 Linus Torvalds */ /* * 'Traps.c' handles hardware traps and faults after we have saved some * state in 'asm.s'. */ #include <linux/cpufeature.h> #include <linux/kprobes.h> #include <linux/kdebug.h> Loading Loading @@ -66,8 +62,7 @@ void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str) static void do_trap(struct pt_regs *regs, int si_signo, int si_code, char *str) { if (notify_die(DIE_TRAP, str, regs, 0, regs->int_code, si_signo) == NOTIFY_STOP) if (notify_die(DIE_TRAP, str, regs, 0, regs->int_code, si_signo) == NOTIFY_STOP) return; do_report_trap(regs, si_signo, si_code, str); } Loading @@ -79,8 +74,7 @@ void do_per_trap(struct pt_regs *regs) return; if (!current->ptrace) return; force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __force __user *) current->thread.per_event.address); force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __force __user *)current->thread.per_event.address); } NOKPROBE_SYMBOL(do_per_trap); Loading @@ -99,36 +93,25 @@ static void name(struct pt_regs *regs) \ do_trap(regs, signr, sicode, str); \ } DO_ERROR_INFO(addressing_exception, SIGILL, ILL_ILLADR, "addressing exception") DO_ERROR_INFO(execute_exception, SIGILL, ILL_ILLOPN, "execute exception") DO_ERROR_INFO(divide_exception, SIGFPE, FPE_INTDIV, "fixpoint divide exception") DO_ERROR_INFO(overflow_exception, SIGFPE, FPE_INTOVF, "fixpoint overflow exception") DO_ERROR_INFO(hfp_overflow_exception, SIGFPE, FPE_FLTOVF, "HFP overflow exception") DO_ERROR_INFO(hfp_underflow_exception, SIGFPE, FPE_FLTUND, "HFP underflow exception") DO_ERROR_INFO(hfp_significance_exception, SIGFPE, FPE_FLTRES, "HFP significance exception") DO_ERROR_INFO(hfp_divide_exception, SIGFPE, FPE_FLTDIV, "HFP divide exception") DO_ERROR_INFO(hfp_sqrt_exception, SIGFPE, FPE_FLTINV, "HFP square root exception") DO_ERROR_INFO(operand_exception, SIGILL, ILL_ILLOPN, "operand exception") DO_ERROR_INFO(privileged_op, SIGILL, ILL_PRVOPC, "privileged operation") DO_ERROR_INFO(special_op_exception, SIGILL, ILL_ILLOPN, "special operation exception") DO_ERROR_INFO(transaction_exception, SIGILL, ILL_ILLOPN, "transaction constraint exception") DO_ERROR_INFO(addressing_exception, SIGILL, ILL_ILLADR, "addressing exception") DO_ERROR_INFO(divide_exception, SIGFPE, FPE_INTDIV, "fixpoint divide exception") DO_ERROR_INFO(execute_exception, SIGILL, ILL_ILLOPN, "execute exception") DO_ERROR_INFO(hfp_divide_exception, SIGFPE, FPE_FLTDIV, "HFP divide exception") DO_ERROR_INFO(hfp_overflow_exception, SIGFPE, FPE_FLTOVF, "HFP overflow exception") DO_ERROR_INFO(hfp_significance_exception, SIGFPE, FPE_FLTRES, "HFP significance exception") DO_ERROR_INFO(hfp_sqrt_exception, SIGFPE, FPE_FLTINV, "HFP square root exception") DO_ERROR_INFO(hfp_underflow_exception, SIGFPE, FPE_FLTUND, "HFP underflow exception") DO_ERROR_INFO(operand_exception, SIGILL, ILL_ILLOPN, "operand exception") DO_ERROR_INFO(overflow_exception, SIGFPE, FPE_INTOVF, "fixpoint overflow exception") DO_ERROR_INFO(privileged_op, SIGILL, ILL_PRVOPC, "privileged operation") DO_ERROR_INFO(special_op_exception, SIGILL, ILL_ILLOPN, "special operation exception") DO_ERROR_INFO(specification_exception, SIGILL, ILL_ILLOPN, "specification exception"); DO_ERROR_INFO(transaction_exception, SIGILL, ILL_ILLOPN, "transaction constraint exception") static inline void do_fp_trap(struct pt_regs *regs, __u32 fpc) { int si_code = 0; /* FPC[2] is Data Exception Code */ if ((fpc & 0x00000300) == 0) { /* bits 6 and 7 of DXC are 0 iff IEEE exception */ Loading Loading @@ -160,7 +143,6 @@ static void illegal_op(struct pt_regs *regs) u16 opcode; location = get_trap_ip(regs); if (user_mode(regs)) { if (get_user(opcode, location)) return; Loading @@ -173,17 +155,17 @@ static void illegal_op(struct pt_regs *regs) } else if (opcode == UPROBE_SWBP_INSN) { is_uprobe_insn = 1; #endif } else } else { signal = SIGILL; } } /* * We got either an illegal op in kernel mode, or user space trapped * This is either an illegal op in kernel mode, or user space trapped * on a uprobes illegal instruction. See if kprobes or uprobes picks * it up. If not, SIGILL. */ if (is_uprobe_insn || !user_mode(regs)) { if (notify_die(DIE_BPT, "bpt", regs, 0, 3, SIGTRAP) != NOTIFY_STOP) if (notify_die(DIE_BPT, "bpt", regs, 0, 3, SIGTRAP) != NOTIFY_STOP) signal = SIGILL; } if (signal) Loading @@ -191,9 +173,6 @@ static void illegal_op(struct pt_regs *regs) } NOKPROBE_SYMBOL(illegal_op); DO_ERROR_INFO(specification_exception, SIGILL, ILL_ILLOPN, "specification exception"); static void vector_exception(struct pt_regs *regs) { int si_code, vic; Loading Loading @@ -245,7 +224,6 @@ static void monitor_event_exception(struct pt_regs *regs) { if (user_mode(regs)) return; switch (report_bug(regs->psw.addr - (regs->int_code >> 16), regs)) { case BUG_TRAP_TYPE_NONE: fixup_exception(regs); Loading Loading @@ -319,7 +297,6 @@ void noinstr __do_pgm_check(struct pt_regs *regs) teid.val = lc->trans_exc_code; regs->int_code = lc->pgm_int_code; regs->int_parm_long = teid.val; /* * In case of a guest fault, short-circuit the fault handler and return. * This way the sie64a() function will return 0; fault address and Loading @@ -332,9 +309,7 @@ void noinstr __do_pgm_check(struct pt_regs *regs) current->thread.gmap_int_code = regs->int_code & 0xffff; return; } state = irqentry_enter(regs); if (user_mode(regs)) { update_timer_sys(); if (!cpu_has_bear()) { Loading @@ -343,12 +318,10 @@ void noinstr __do_pgm_check(struct pt_regs *regs) } current->thread.last_break = regs->last_break; } if (lc->pgm_code & 0x0200) { /* transaction abort */ current->thread.trap_tdb = lc->pgm_tdb; } if (lc->pgm_code & PGM_INT_CODE_PER) { if (user_mode(regs)) { struct per_event *ev = ¤t->thread.per_event; Loading @@ -364,11 +337,9 @@ void noinstr __do_pgm_check(struct pt_regs *regs) goto out; } } if (!irqs_disabled_flags(regs->psw.mask)) trace_hardirqs_on(); __arch_local_irq_ssm(regs->psw.mask & ~PSW_MASK_PER); trapnr = regs->int_code & PGM_INT_CODE_MASK; if (trapnr) pgm_check_table[trapnr](regs); Loading