linux-stable/arch/arm/kernel
Tomislav Novak d228251563 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:48:15 +02:00
..
.gitignore
arch_timer.c
armksyms.c
asm-offsets.c ARM: 9075/1: kernel: Fix interrupted SMC calls 2021-05-22 10:59:49 +02:00
atags.h
atags_compat.c
atags_parse.c
atags_proc.c
bios32.c
bugs.c ARM: cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:49:17 +02:00
cpuidle.c
crash_dump.c
debug.S
devtree.c
dma-isa.c
dma.c
early_printk.c
efi.c
elf.c
entry-armv.S ARM: 9197/1: spectre-bhb: fix loop8 sequence for Thumb2 2022-05-25 09:10:40 +02:00
entry-common.S ARM: Spectre-BHB workaround 2022-03-11 10:15:12 +01:00
entry-ftrace.S
entry-header.S ARM: uaccess: consolidate uaccess asm to asm/uaccess-asm.h 2020-06-03 08:19:34 +02:00
entry-v7m.S ARM: 8830/1: NOMMU: Toggle only bits in EXC_RETURN we are really care of 2019-04-05 22:33:12 +02:00
fiq.c
fiqasm.S
ftrace.c ARM: 9079/1: ftrace: Add MODULE_PLTS support 2021-10-06 15:31:26 +02:00
head-common.S ARM: 8914/1: NOMMU: Fix exc_ret for XIP 2019-11-06 13:06:10 +01:00
head-inflate-data.c
head-nommu.S ARM: 8849/1: NOMMU: Fix encodings for PMSAv8's PRBAR4/PRLAR4 2020-01-27 14:50:28 +01:00
head.S ARM: p2v: fix handling of LPAE translation in BE mode 2020-12-30 11:25:50 +01:00
hibernate.c
hw_breakpoint.c hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-09-23 10:48:15 +02:00
hyp-stub.S ARM: 8955/1: virt: Relax arch timer version check during early boot 2020-02-05 14:43:50 +00:00
insn.c ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link() 2021-10-06 15:31:26 +02:00
io.c
irq.c ARM: 8824/1: fix a migrating irq bug when hotplug cpu 2019-03-23 20:09:48 +01:00
isa.c
iwmmxt.S
jump_label.c jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00
kgdb.c
machine_kexec.c ARM: kexec: fix oops after TLB are invalidated 2021-02-23 15:00:57 +01:00
Makefile ARM: report Spectre v2 status through sysfs 2022-03-11 10:15:11 +01:00
module-plts.c ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE 2021-10-06 15:31:26 +02:00
module.c
module.lds
opcodes.c
paravirt.c
patch.c ARM: 8839/1: kprobe: make patch_lock a raw_spinlock_t 2019-04-20 09:16:04 +02:00
perf_callchain.c
perf_event_v6.c
perf_event_v7.c arm_pmu: Fix write counter incorrect in ARMv7 big-endian mode 2021-07-20 16:15:39 +02:00
perf_event_xscale.c
perf_regs.c
pj4-cp0.c
process.c mm: zero out the vma in vma_init() 2018-08-22 10:52:44 -07:00
psci_smp.c
ptrace.c ARM: 8977/1: ptrace: Fix mask for thumb breakpoint hook 2020-06-22 09:04:59 +02:00
reboot.c
reboot.h
relocate_kernel.S ARM: kexec: fix oops after TLB are invalidated 2021-02-23 15:00:57 +01:00
return_address.c ARM: 8918/2: only build return_address() if needed 2021-09-22 11:47:46 +02:00
setup.c ARM: 9081/1: fix gcc-10 thumb2-kernel regression 2021-06-30 08:48:28 -04:00
signal.c ARM: ensure the signal page contains defined contents 2021-02-23 15:00:57 +01:00
signal.h
sigreturn_codes.S
sleep.S ARM: 8847/1: pm: fix HYP/SVC mode mismatch when MCPM is used 2020-01-27 14:50:28 +01:00
smccc-call.S ARM: 9075/1: kernel: Fix interrupted SMC calls 2021-05-22 10:59:49 +02:00
smp.c ARM: prevent tracing IPI_CPU_BACKTRACE 2019-06-15 11:54:00 +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:15:12 +01:00
stacktrace.c ARM: 9191/1: arm/stacktrace, kasan: Silence KASAN warnings in unwind_frame() 2022-05-25 09:10:37 +02:00
suspend.c ARM: 9066/1: ftrace: pause/unpause function graph tracer in cpu_suspend() 2021-05-22 10:59:48 +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:25:36 +01:00
tcm.c
thumbee.c
time.c
topology.c
traps.c exit: Add and use make_task_dead. 2023-02-06 07:49:45 +01:00
unwind.c ARM: 9295/1: unwind:fix unwind abort for uleb128 case 2023-06-09 10:23:57 +02:00
v7m.c
vdso.c ARM: 8957/1: VDSO: Match ARMv8 timer in cntvct_functional() 2020-03-20 11:55:59 +01:00
vmlinux-xip.lds.S ARM: 9141/1: only warn about XIP address when not compile testing 2021-11-02 18:26:43 +01:00
vmlinux.lds.h ARM: Do not use NOCROSSREFS directive with ld.lld 2022-03-11 10:15:12 +01:00
vmlinux.lds.S
xscale-cp0.c