Linux Trace Kernel
 help / color / mirror / Atom feed
* [RFC 0/2] arm64: kprobes: Fix single-step fault and reentry handling
@ 2026-07-01 12:14 Pu Hu
  2026-07-01 12:14 ` [RFC 1/2] arm64: kprobes: Do not handle non-XOL faults as kprobe faults Pu Hu
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Pu Hu @ 2026-07-01 12:14 UTC (permalink / raw)
  To: catalin.marinas@arm.com, will@kernel.org, naveen@kernel.org,
	davem@davemloft.net, mhiramat@kernel.org,
	yang@os.amperecomputing.com, Hongyan Xia, Jiazi Li,
	ada.coupriediaz@arm.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
  Cc: Pu Hu

From: hupu <hupu@transsion.com>

This series fixes two arm64 kprobes issues observed when running
simpleperf with preemptirq tracepoints and dwarf callchains while a
kprobe is active on a frequently executed kernel function.

The crash happens in the kprobe debug exception path. While a kprobe is
preparing or executing its XOL single-step instruction, perf/trace code
can run in the same window. That code may either take a fault of its own
or hit another kprobe.

Patch 1 makes kprobe_fault_handler() handle a fault in
KPROBE_HIT_SS/KPROBE_REENTER only when the faulting PC points at the
current kprobe's XOL instruction. Otherwise the fault is left to the
normal fault handling path.

Patch 2 allows a kprobe hit in KPROBE_HIT_SS to be handled as a
recoverable one-level reentry. Only a hit while already in
KPROBE_REENTER remains unrecoverable.

This follows the same logic as the existing x86 fixes:
  6381c24cd6d5 ("kprobes/x86: Fix page-fault handling logic")
  6a5022a56ac3 ("kprobes/x86: Allow to handle reentered kprobe on single-stepping")

Reproducer:

  simpleperf record -p <pid> -f 10000 \
    -e preemptirq:preempt_disable \
    -e preemptirq:preempt_enable \
    --duration 9 --call-graph dwarf \
    -o /data/local/tmp/perf.data

Before this series, the crash reproduced frequently. With both patches
applied, it was no longer reproduced in our testing.

hupu (2):
  arm64: kprobes: Do not handle non-XOL faults as kprobe faults
  arm64: kprobes: Allow reentering kprobes while single-stepping

 arch/arm64/kernel/probes/kprobes.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-07-02 10:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 12:14 [RFC 0/2] arm64: kprobes: Fix single-step fault and reentry handling Pu Hu
2026-07-01 12:14 ` [RFC 1/2] arm64: kprobes: Do not handle non-XOL faults as kprobe faults Pu Hu
2026-07-01 12:15 ` [RFC 2/2] arm64: kprobes: Allow reentering kprobes while single-stepping Pu Hu
2026-07-01 12:30 ` [RFC 0/2] arm64: kprobes: Fix single-step fault and reentry handling Pu Hu
2026-07-01 13:43 ` Masami Hiramatsu
2026-07-01 13:56   ` Pu Hu
2026-07-02 10:07     ` Pu Hu
2026-07-02 10:09       ` Pu Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox