diff options
| -rw-r--r-- | arch/arm64/include/asm/system_misc.h | 13 | ||||
| -rw-r--r-- | arch/arm64/kernel/traps.c | 5 | ||||
| -rw-r--r-- | arch/arm64/mm/fault.c | 3 |
3 files changed, 16 insertions, 5 deletions
diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h index 659fbf5925de..57f110bea6a8 100644 --- a/arch/arm64/include/asm/system_misc.h +++ b/arch/arm64/include/asm/system_misc.h | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | #include <linux/compiler.h> | 23 | #include <linux/compiler.h> |
| 24 | #include <linux/linkage.h> | 24 | #include <linux/linkage.h> |
| 25 | #include <linux/irqflags.h> | 25 | #include <linux/irqflags.h> |
| 26 | #include <linux/signal.h> | ||
| 27 | #include <linux/ratelimit.h> | ||
| 26 | #include <linux/reboot.h> | 28 | #include <linux/reboot.h> |
| 27 | 29 | ||
| 28 | struct pt_regs; | 30 | struct pt_regs; |
| @@ -43,6 +45,17 @@ extern void __show_regs(struct pt_regs *); | |||
| 43 | 45 | ||
| 44 | extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); | 46 | extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); |
| 45 | 47 | ||
| 48 | #define show_unhandled_signals_ratelimited() \ | ||
| 49 | ({ \ | ||
| 50 | static DEFINE_RATELIMIT_STATE(_rs, \ | ||
| 51 | DEFAULT_RATELIMIT_INTERVAL, \ | ||
| 52 | DEFAULT_RATELIMIT_BURST); \ | ||
| 53 | bool __show_ratelimited = false; \ | ||
| 54 | if (show_unhandled_signals && __ratelimit(&_rs)) \ | ||
| 55 | __show_ratelimited = true; \ | ||
| 56 | __show_ratelimited; \ | ||
| 57 | }) | ||
| 58 | |||
| 46 | #define UDBG_UNDEFINED (1 << 0) | 59 | #define UDBG_UNDEFINED (1 << 0) |
| 47 | #define UDBG_SYSCALL (1 << 1) | 60 | #define UDBG_SYSCALL (1 << 1) |
| 48 | #define UDBG_BADABORT (1 << 2) | 61 | #define UDBG_BADABORT (1 << 2) |
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 1ef2940df13c..a12251c074a8 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c | |||
| @@ -335,8 +335,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) | |||
| 335 | if (call_undef_hook(regs) == 0) | 335 | if (call_undef_hook(regs) == 0) |
| 336 | return; | 336 | return; |
| 337 | 337 | ||
| 338 | if (show_unhandled_signals && unhandled_signal(current, SIGILL) && | 338 | if (show_unhandled_signals_ratelimited() && unhandled_signal(current, SIGILL)) { |
| 339 | printk_ratelimit()) { | ||
| 340 | pr_info("%s[%d]: undefined instruction: pc=%p\n", | 339 | pr_info("%s[%d]: undefined instruction: pc=%p\n", |
| 341 | current->comm, task_pid_nr(current), pc); | 340 | current->comm, task_pid_nr(current), pc); |
| 342 | dump_instr(KERN_INFO, regs); | 341 | dump_instr(KERN_INFO, regs); |
| @@ -363,7 +362,7 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs) | |||
| 363 | } | 362 | } |
| 364 | #endif | 363 | #endif |
| 365 | 364 | ||
| 366 | if (show_unhandled_signals && printk_ratelimit()) { | 365 | if (show_unhandled_signals_ratelimited()) { |
| 367 | pr_info("%s[%d]: syscall %d\n", current->comm, | 366 | pr_info("%s[%d]: syscall %d\n", current->comm, |
| 368 | task_pid_nr(current), (int)regs->syscallno); | 367 | task_pid_nr(current), (int)regs->syscallno); |
| 369 | dump_instr("", regs); | 368 | dump_instr("", regs); |
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index e8c608c893cf..66bd92ab6f7b 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c | |||
| @@ -115,8 +115,7 @@ static void __do_user_fault(struct task_struct *tsk, unsigned long addr, | |||
| 115 | { | 115 | { |
| 116 | struct siginfo si; | 116 | struct siginfo si; |
| 117 | 117 | ||
| 118 | if (show_unhandled_signals && unhandled_signal(tsk, sig) && | 118 | if (show_unhandled_signals_ratelimited() && unhandled_signal(tsk, sig)) { |
| 119 | printk_ratelimit()) { | ||
| 120 | pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n", | 119 | pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n", |
| 121 | tsk->comm, task_pid_nr(tsk), fault_name(esr), sig, | 120 | tsk->comm, task_pid_nr(tsk), fault_name(esr), sig, |
| 122 | addr, esr); | 121 | addr, esr); |
