android_kernel_xiaomi_sm8450/arch
Tomislav Novak 020ecfa7b6 hw_breakpoint: fix single-stepping when using bpf_overflow_handler
[ Upstream commit d11a69873d9a7435fe6a48531e165ab80a8b1221 ]

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:01:05 +02:00
..
alpha alpha: remove __init annotation from exported page_is_ram() 2023-08-16 18:21:03 +02:00
arc ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard 2023-07-27 08:44:00 +02:00
arm hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-09-23 11:01:05 +02:00
arm64 hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-09-23 11:01:05 +02:00
c6x c6x: add support for TIF_NOTIFY_SIGNAL 2023-01-04 11:39:21 +01:00
csky csky: Fix function name in csky_alignment() and die() 2023-02-01 08:23:20 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:23:19 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:23:19 +01:00
ia64 ia64/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
m68k m68k: Fix invalid .section syntax 2023-09-19 12:20:04 +02:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
mips mmc: au1xmmc: force non-modular build and remove symbol_get usage 2023-09-19 12:20:02 +02:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:45:37 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-17 11:48:03 +02:00
parisc parisc: Drop loops_per_jiffy from per_cpu struct 2023-09-19 12:20:30 +02:00
powerpc powerpc/iommu: Fix notifiers being shared by PCI and VIO buses 2023-09-19 12:20:15 +02:00
riscv riscv,mmio: Fix readX()-to-delay() ordering 2023-08-16 18:20:59 +02:00
s390 s390/ipl: add missing secure/has_secure file to ipl type 'unknown' 2023-09-19 12:20:22 +02:00
sh sh: boards: Fix CEU buffer size passed to dma_declare_coherent_memory() 2023-09-19 12:20:27 +02:00
sparc sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:37 +02:00
um um: Fix hostaudio build errors 2023-09-19 12:20:20 +02:00
x86 x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm() 2023-09-19 12:20:25 +02:00
xtensa xtensa: PMU: fix base address for the newer hardware 2023-09-19 12:20:21 +02:00
.gitignore
Kconfig init: Provide arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00