linux-stable/arch
Tomislav Novak 4180b3ad76 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 11:14:19 +02:00
..
alpha Kbuild fixes for v6.5 (2nd) 2023-08-13 08:56:24 -07:00
arc ARC: atomics: Add compiler barrier to atomic operations... 2023-09-19 12:30:22 +02:00
arm hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-09-23 11:14:19 +02:00
arm64 hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-09-23 11:14:19 +02:00
csky
hexagon
ia64 locking: remove spin_lock_prefetch 2023-08-12 09:18:47 -07:00
loongarch LoongArch: mm: Add p?d_leaf() definitions 2023-09-13 09:53:52 +02:00
m68k m68k: Fix invalid .section syntax 2023-07-24 14:50:02 +02:00
microblaze
mips MIPS: Fix CONFIG_CPU_DADDI_WORKAROUNDS `modules_install' regression 2023-09-19 12:30:26 +02:00
nios2
openrisc
parisc parisc: sba_iommu: Fix build warning if procfs if disabled 2023-09-19 12:30:27 +02:00
powerpc powerpc/ftrace: Fix dropping weak symbols with older toolchains 2023-09-13 09:53:52 +02:00
riscv RISC-V: Add ptrace support for vectors 2023-09-13 09:53:55 +02:00
s390 s390/boot: cleanup number of page table levels setup 2023-09-23 11:14:18 +02:00
sh sh: push-switch: Reorder cleanup operations to avoid use-after-free bug 2023-09-19 12:30:21 +02:00
sparc nmi_backtrace: allow excluding an arbitrary CPU 2023-09-13 09:53:08 +02:00
um um: virt-pci: fix missing declaration warning 2023-09-13 09:53:48 +02:00
x86 x86/amd_nb: Add PCI IDs for AMD Family 1Ah-based models 2023-09-23 11:14:18 +02:00
xtensa xtensa: PMU: fix base address for the newer hardware 2023-09-13 09:53:51 +02:00
.gitignore
Kconfig