linux-stable/arch/arm/kernel
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
..
.gitignore
arch_timer.c
armksyms.c
asm-offsets.c
atags.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
atags_compat.c
atags_parse.c
atags_proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bios32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bugs.c ARM: cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:48:23 +02:00
cpuidle.c
crash_dump.c
debug.S ARM: 8704/1: semihosting: use proper instruction on v7m processors 2017-10-12 11:28:29 +01:00
devtree.c
dma-isa.c
dma.c
early_printk.c
efi.c
elf.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
entry-armv.S ARM: 9197/1: spectre-bhb: fix loop8 sequence for Thumb2 2022-05-25 08:41:20 +02:00
entry-common.S ARM: Spectre-BHB workaround 2022-03-11 10:13:30 +01:00
entry-ftrace.S
entry-header.S ARM: uaccess: consolidate uaccess asm to asm/uaccess-asm.h 2020-06-03 08:17:58 +02:00
entry-v7m.S ARM: 8830/1: NOMMU: Toggle only bits in EXC_RETURN we are really care of 2019-04-05 22:31:37 +02:00
fiq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fiqasm.S
ftrace.c ARM: 9079/1: ftrace: Add MODULE_PLTS support 2021-10-06 15:05:10 +02:00
head-common.S ARM: 8702/1: head-common.S: Clear lr before jumping to start_kernel() 2020-08-07 09:38:42 +02:00
head-nommu.S
head.S ARM: p2v: fix handling of LPAE translation in BE mode 2020-12-29 13:46:51 +01:00
hibernate.c
hw_breakpoint.c hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-09-23 10:47:03 +02:00
hyp-stub.S ARM: 8955/1: virt: Relax arch timer version check during early boot 2020-02-05 14:18:23 +00:00
insn.c ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link() 2021-10-06 15:05:10 +02:00
io.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irq.c ARM: 8824/1: fix a migrating irq bug when hotplug cpu 2019-03-23 14:35:14 +01:00
isa.c
iwmmxt.S
jump_label.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kgdb.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
machine_kexec.c ARM: avoid Cortex-A9 livelock on tight dmb loops 2019-04-05 22:31:37 +02:00
Makefile ARM: report Spectre v2 status through sysfs 2022-03-11 10:13:30 +01:00
module-plts.c ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE 2021-10-06 15:05:10 +02:00
module.c
module.lds License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
opcodes.c
paravirt.c
patch.c ARM: 8839/1: kprobe: make patch_lock a raw_spinlock_t 2019-04-20 09:15:07 +02:00
perf_callchain.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf_event_v6.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf_event_v7.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf_event_xscale.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf_regs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pj4-cp0.c
process.c
psci_smp.c
ptrace.c ARM: 8977/1: ptrace: Fix mask for thumb breakpoint hook 2020-06-20 10:24:59 +02:00
reboot.c
reboot.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
relocate_kernel.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
return_address.c ARM: 8918/2: only build return_address() if needed 2021-09-22 11:45:15 +02:00
setup.c ARM: 9081/1: fix gcc-10 thumb2-kernel regression 2021-06-30 08:48:56 -04:00
signal.c ARM: ensure the signal page contains defined contents 2021-02-23 14:00:32 +01:00
sigreturn_codes.S
sleep.S ARM: 8847/1: pm: fix HYP/SVC mode mismatch when MCPM is used 2020-01-27 14:46:22 +01:00
smccc-call.S
smp.c ARM: prevent tracing IPI_CPU_BACKTRACE 2019-06-15 11:54:51 +02:00
smp_scu.c
smp_tlb.c
smp_twd.c
spectre.c ARM: fix build error when BPF_SYSCALL is disabled 2022-03-11 10:13:31 +01:00
stacktrace.c ARM: 9191/1: arm/stacktrace, kasan: Silence KASAN warnings in unwind_frame() 2022-05-25 08:41:18 +02:00
suspend.c ARM: 9066/1: ftrace: pause/unpause function graph tracer in cpu_suspend() 2021-05-22 10:57:42 +02:00
swp_emulate.c
sys_arm.c
sys_oabi-compat.c ARM: 8792/1: oabi-compat: copy oabi events using __copy_to_user() 2019-02-20 10:20:45 +01:00
tcm.c
thumbee.c
time.c
topology.c
traps.c exit: Add and use make_task_dead. 2023-02-06 07:46:33 +01:00
unwind.c ARM: 9295/1: unwind:fix unwind abort for uleb128 case 2023-06-09 10:22:49 +02:00
v7m.c
vdso.c ARM: 8957/1: VDSO: Match ARMv8 timer in cntvct_functional() 2020-03-20 10:54:26 +01:00
vmlinux-xip.lds.S ARM: Do not use NOCROSSREFS directive with ld.lld 2022-03-11 10:13:31 +01:00
vmlinux.lds.S ARM: Do not use NOCROSSREFS directive with ld.lld 2022-03-11 10:13:31 +01:00
xscale-cp0.c