linux/arch/arm64
Tomislav Novak 4252c35010 hw_breakpoint: fix single-stepping when using bpf_overflow_handler
[ Upstream commit d11a69873d ]

Arm platforms use is_default_overflow_handler() to determine if the
hw_breakpoint code should single-step over the breakpoint trigger or
let the custom handler deal with it.

Since bpf_overflow_handler() currently isn't recognized as a default
handler, attaching a BPF program to a PERF_TYPE_BREAKPOINT event causes
it to keep firing (the instruction triggering the data abort exception
is never skipped). For example:

  # bpftrace -e 'watchpoint:0x10000:4:w { print("hit") }' -c ./test
  Attaching 1 probe...
  hit
  hit
  [...]
  ^C

(./test performs a single 4-byte store to 0x10000)

This patch replaces the check with uses_default_overflow_handler(),
which accounts for the bpf_overflow_handler() case by also testing
if one of the perf_event_output functions gets invoked indirectly,
via orig_default_handler.

Signed-off-by: Tomislav Novak <tnovak@meta.com>
Tested-by: Samuel Gosselin <sgosselin@google.com> # arm64
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/linux-arm-kernel/20220923203644.2731604-1-tnovak@fb.com/
Link: https://lore.kernel.org/r/20230605191923.1219974-1-tnovak@meta.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-23 10:47:03 +02:00
..
boot arm64: dts: amlogic: meson-gxl: add missing unit address to eth-phy-mux node name 2023-03-11 16:26:34 +01:00
configs arm64: defconfig: Enable Rockchip io-domain driver 2018-08-03 07:50:38 +02:00
crypto crypto: arm64/sha2-ce - correct digest for empty data in finup 2019-07-31 07:28:35 +02:00
include arm64: Add missing Set/Way CMO encodings 2023-06-28 10:14:20 +02:00
kernel hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-09-23 10:47:03 +02:00
kvm arm64: KVM: Fix system register enumeration 2023-04-20 12:02:12 +02:00
lib arm64: lib: use C string functions with KASAN enabled 2019-12-01 09:13:48 +01:00
mm exit: Add and use make_task_dead. 2023-02-06 07:46:33 +01:00
net bpf: get rid of pure_initcall dependency to enable jits 2019-08-25 10:50:02 +02:00
xen arm64: kpti: Fix the interaction between ASID switching and software PAN 2018-02-16 20:22:49 +01:00
Kconfig arm64: errata: Remove AES hwcap for COMPAT tasks 2022-11-03 23:50:50 +09:00
Kconfig.debug arm64: relocation testing module 2017-04-04 17:03:32 +01:00
Kconfig.platforms arm64: berlin: Select DW_APB_TIMER_OF 2020-11-05 11:07:04 +01:00
Makefile arm64: link with -z norelro regardless of CONFIG_RELOCATABLE 2020-11-05 11:06:51 +01:00