]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: kprobes: Use BRK instead of single-step when executing instructions out-of...
authorJean-Philippe Brucker <jean-philippe@linaro.org>
Tue, 3 Nov 2020 13:49:01 +0000 (14:49 +0100)
committerWill Deacon <will@kernel.org>
Tue, 3 Nov 2020 14:03:38 +0000 (14:03 +0000)
commitff1db149187920edaac8721e2d869669cf4c8fbf
tree901c9487d9137d2c88dcdb5f0e9100f323fc9e53
parent3c01bb62e2854845d3f8c4742be9c2b211cd24ea
arm64: kprobes: Use BRK instead of single-step when executing instructions out-of-line

Commit 437a17c0a7a6 ("kprobes: Init kprobes in early_initcall") enabled
using kprobes from early_initcall. Unfortunately at this point the
hardware debug infrastructure is not operational. The OS lock may still
be locked, and the hardware watchpoints may have unknown values when
kprobe enables debug monitors to single-step instructions.

Rather than using hardware single-step, append a BRK instruction after
the instruction to be executed out-of-line.

Fixes: 437a17c0a7a6 ("kprobes: Init kprobes in early_initcall")
Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20201103134900.337243-1-jean-philippe@linaro.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/brk-imm.h
arch/arm64/include/asm/debug-monitors.h
arch/arm64/include/asm/kprobes.h
arch/arm64/kernel/probes/kprobes.c