]> git.baikalelectronics.ru Git - kernel.git/commit
arch/sh: Check for kprobe trap number before trying to handle a kprobe trap
authorMichael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Wed, 12 Jun 2019 13:08:37 +0000 (15:08 +0200)
committerYoshinori Sato <ysato@users.sourceforge.jp>
Wed, 26 Jun 2019 10:11:13 +0000 (19:11 +0900)
commit10186de64bca887f1f1e85daed49592881bc5002
tree33224cefb6689fd0b1317c1adf34763cf9dff903
parenta38126b85bc10c4ce03293d3a9e8456241655f38
arch/sh: Check for kprobe trap number before trying to handle a kprobe trap

The DIE_TRAP notifier chain is run both for kprobe traps and for BUG/WARN
traps. The kprobe code assumes to be only called for
BREAKPOINT_INSTRUCTION, and concludes to have hit a concurrently removed
kprobe if it finds anything else at the faulting locations. This includes
TRAPA_BUG_OPCODE used for BUG and WARN.

The consequence is that kprobe_handler returns 1. This makes
kprobe_exceptions_notify return NOTIFY_STOP, and prevents handling the BUG
statement. This also prevents moving $pc away from the trap instruction,
so the system locks up in an endless loop

Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
arch/sh/kernel/kprobes.c