linux/arch/arm64/kernel
Pu Hu 23f851ac00 arm64: kprobes: Allow reentering kprobes while single-stepping
A kprobe can be hit while another kprobe is in KPROBE_HIT_SS state. This
can happen when tracing or perf code runs from the debug exception path
while the first kprobe is preparing or executing its out-of-line
single-step instruction.

Currently arm64 treats a kprobe hit in KPROBE_HIT_SS as unrecoverable,
the same as a hit in KPROBE_REENTER. This is too strict. A hit in
KPROBE_HIT_SS is still a one-level reentry and can be handled by saving
the current kprobe state and setting up single-step for the new probe,
just like reentry from KPROBE_HIT_ACTIVE or KPROBE_HIT_SSDONE.

The truly unrecoverable case is hitting another kprobe while already in
KPROBE_REENTER, because the reentry save area has already been consumed.

Move KPROBE_HIT_SS to the recoverable reentry cases and leave
KPROBE_REENTER as the unrecoverable nested reentry case.

This change also requires saving saved_irqflag in struct prev_kprobe.
When a nested kprobe calls kprobes_save_local_irqflag(), it overwrites
kcb->saved_irqflag with the currently masked DAIF value, losing the
outer kprobe's original DAIF state. Without this fix, when the outer
kprobe's single-step finishes, kprobes_restore_local_irqflag() applies
the wrong DAIF mask and leaves interrupts permanently disabled.

Extend struct prev_kprobe with a saved_irqflag field and save/restore it
alongside kp and status. This ensures the outer kprobe's original
interrupt state is preserved across reentry.

This mirrors the x86 fix in commit 6a5022a56a
("kprobes/x86: Allow to handle reentered kprobe on single-stepping").

Signed-off-by: Pu Hu <hupu@transsion.com>
Signed-off-by: Hongyan Xia <hongyan.xia@transsion.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
2026-07-17 19:03:08 +01:00
..
pi arm64 updates for 7.2 2026-06-16 05:18:04 +05:30
probes arm64: kprobes: Allow reentering kprobes while single-stepping 2026-07-17 19:03:08 +01:00
vdso stackleak: Split KSTACK_ERASE_CFLAGS from GCC_PLUGINS_CFLAGS 2025-07-21 21:40:57 -07:00
vdso32 kbuild: Consolidate C dialect options 2026-03-12 12:52:37 +01:00
.gitignore
acpi_numa.c
acpi_parking_protocol.c
acpi.c cpu/hotplug: Fix NULL kobject warning in cpuhp_smt_enable() 2026-06-29 11:47:36 +01:00
alternative.c arm64: Reject modules with internal alternative callbacks 2025-11-07 15:00:14 +00:00
armv8_deprecated.c arm64: armv8_deprecated: Disable swp emulation when FEAT_LSUI present 2026-03-27 17:29:10 +00:00
asm-offsets.c arch: Add the macro COMPILE_OFFSETS to all the asm-offsets.c 2025-09-25 09:57:15 +02:00
cacheinfo.c arm64: cacheinfo: Avoid out-of-bounds write to cacheinfo array 2025-02-07 09:57:56 +00:00
compat_alignment.c arm64: Don't call NULL in do_compat_alignment_fixup() 2025-04-01 14:13:11 +01:00
cpu_errata.c arm64: errata: Mitigate TLBI errata on Microsoft Azure Cobalt 100 CPU 2026-06-10 12:00:21 +01:00
cpu_ops.c
cpu-reset.S
cpufeature.c Arm: 2026-06-19 08:56:49 -07:00
cpuinfo.c arm64/cpufeature: Define hwcaps for 2025 dpISA features 2026-05-19 13:57:51 +01:00
crash_dump.c
debug-monitors.c arm64 updates for 6.18 2025-09-29 18:48:39 -07:00
efi-header.S include: pe.h: Fix PE definitions 2025-05-21 16:46:37 +02:00
efi-rt-wrapper.S
efi.c arm64/mm: Rename ptdesc_t 2026-06-05 11:44:36 +01:00
elfcore.c fs: avoid mmap sem relocks when coredumping with many missing pages 2025-02-21 10:25:32 +01:00
entry-common.c arm64 updates for 7.2 2026-06-16 05:18:04 +05:30
entry-ftrace.S arm64: Fix double word in comments 2025-11-12 17:07:59 +00:00
entry.S Merge branches 'for-next/misc', 'for-next/tlbflush', 'for-next/ttbr-macros-cleanup', 'for-next/kselftest', 'for-next/feat_lsui', 'for-next/mpam', 'for-next/hotplug-batched-tlbi', 'for-next/bbml2-fixes', 'for-next/sysreg', 'for-next/generic-entry' and 'for-next/acpi', remote-tracking branches 'arm64/for-next/perf' and 'arm64/for-next/read-once' into for-next/core 2026-04-10 14:22:24 +01:00
fpsimd.c arm64: Avoid eager DVMSync reclaim batches with C1-Pro SME erratum 2026-06-29 12:00:37 +01:00
ftrace.c arm64: Fix typos and spelling errors in comments 2025-11-12 17:06:21 +00:00
head.S KVM: arm64: Trap MTE access and discovery when MTE is disabled 2026-01-23 11:28:48 +00:00
hibernate-asm.S
hibernate.c arm64: Set __nocfi on swsusp_arch_resume() 2026-01-23 18:13:07 +00:00
hw_breakpoint.c arm64/hw_breakpoint: reject unaligned watchpoints that would truncate BAS 2026-06-19 17:04:57 +01:00
hyp-stub.S KVM: arm64: Don't populate TPIDR_EL2 in finalise_el2() 2026-05-27 15:30:39 +01:00
idle.c
image-vars.h KVM: arm64: Add event support to the nVHE/pKVM hyp and trace remote 2026-03-11 08:51:17 +00:00
image.h
io.c
irq.c arm64: panic from init_IRQ if IRQ handler stacks cannot be allocated 2026-05-19 12:27:10 +01:00
jump_label.c
kaslr.c arm64/mm: Remove randomization of the linear map 2025-04-29 13:21:49 +01:00
kexec_image.c arm64: kernel: initialize missing kexec_buf->random field 2026-01-05 21:27:43 +00:00
kgdb.c arm64: debug: call step handlers statically 2025-07-08 13:27:41 +01:00
kuser32.S
machine_kexec_file.c arm64,ppc64le/kdump: pass dm-crypt keys to kdump kernel 2026-04-02 23:36:24 -07:00
machine_kexec.c arm64: kexec: Remove duplicate allocation for trans_pgd 2026-04-08 17:49:08 +01:00
Makefile arm64: fpsimd: Move SME save/restore inline 2026-06-03 16:50:49 +01:00
Makefile.syscalls
module-plts.c arm64: ftrace: fix unreachable PLT for ftrace_caller in init_module with CONFIG_DYNAMIC_FTRACE 2025-09-05 16:56:20 +01:00
module.c arm64: Reject modules with internal alternative callbacks 2025-11-07 15:00:14 +00:00
mpam.c arm64: mpam: Initialise and context switch the MPAMSM_EL1 register 2026-03-27 15:29:02 +00:00
mte.c exec_state: relocate dumpable information 2026-05-26 11:02:01 +02:00
paravirt.c arm64/paravirt: Use common code for paravirt_steal_clock() 2026-01-12 16:30:00 +01:00
patching.c arm64: patching: replace min_t with min in __text_poke 2026-06-03 21:15:24 +01:00
pci.c
perf_callchain.c
perf_regs.c
pointer_auth.c
process.c arm64: Avoid eager DVMSync reclaim batches with C1-Pro SME erratum 2026-06-29 12:00:37 +01:00
proton-pack.c arm64: proton-pack: use sysfs_emit in sysfs show functions 2026-05-19 12:16:12 +01:00
psci.c
ptrace.c Revert "arm64: syscall: Ensure saved x0 is kept in-sync with tracer updates" 2026-07-17 17:25:58 +01:00
reloc_test_core.c
reloc_test_syms.S
relocate_kernel.S arm64: Provide dcache_by_myline_op_nosync helper 2026-03-13 23:46:32 +01:00
return_address.c
rsi.c arm64 updates for 7.1: 2026-04-14 16:48:56 -07:00
sdei.c Merge branches 'for-next/misc', 'for-next/kselftest', 'for-next/efi-preempt', 'for-next/assembler-macro', 'for-next/typos', 'for-next/sme-ptrace-disable', 'for-next/local-tlbi-page-reused', 'for-next/mpam', 'for-next/acpi' and 'for-next/documentation', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2025-11-28 15:47:12 +00:00
setup.c arm64: map [_text, _stext) virtual address range non-executable+read-only 2025-09-22 11:58:17 +01:00
signal.c arm64: signal: Preserve POR_EL0 if poe_context is missing 2026-05-01 17:44:25 +01:00
signal32.c arm64/fpsimd: signal32: Always save+flush state early 2025-04-09 18:06:31 +01:00
sigreturn32.S
sleep.S
smccc-call.S
smp_spin_table.c
smp.c cpu/hotplug: Fix NULL kobject warning in cpuhp_smt_enable() 2026-06-29 11:47:36 +01:00
stacktrace.c Merge branches 'for-next/livepatch', 'for-next/user-contig-bbml2', 'for-next/misc', 'for-next/acpi', 'for-next/debug-entry', 'for-next/feat_mte_tagged_far', 'for-next/kselftest', 'for-next/mdscr-cleanup' and 'for-next/vmap-stack', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2025-07-24 16:01:22 +01:00
static_call.c arm64: static_call: include asm/insns.h 2026-06-19 15:27:33 +01:00
suspend.c
sys_compat.c Merge branch 'for-next/c1-pro-erratum-4193714' into for-next/core 2026-04-20 13:12:35 +01:00
sys.c
sys32.c fs: fix archiecture-specific compat_ftruncate64 2026-03-23 12:41:57 +01:00
syscall.c randomize_kstack: Unify random source across arches 2026-03-24 21:12:03 -07:00
time.c
topology.c arm64: topology: Fix false warning in counters_read_on_cpu() for same-CPU reads 2026-02-26 18:27:15 +00:00
trace-events-emulation.h
traps.c arm64: Fix typos and spelling errors in comments 2025-11-12 17:06:21 +00:00
vdso-wrap.S
vdso.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
vdso32-wrap.S
vmcore_info.c arm64/sysreg: Replace TCR_EL1 field macros 2025-11-13 15:58:30 +00:00
vmlinux.lds.S arm64 updates for 7.2 2026-06-16 05:18:04 +05:30
watchdog_hld.c arm64/watchdog_hld: Add a cpufreq notifier for update watchdog thresh 2025-07-04 13:17:30 +01:00