linux-stable/arch/arm64/kernel
Puranjay Mohan 2c79bd34af arm64: prohibit probing on arch_kunwind_consume_entry()
Make arch_kunwind_consume_entry() as __always_inline otherwise the
compiler might not inline it and allow attaching probes to it.

Without this, just probing arch_kunwind_consume_entry() via
<tracefs>/kprobe_events will crash the kernel on arm64.

The crash can be reproduced using the following compiler and kernel
combination:
clang version 19.0.0git (https://github.com/llvm/llvm-project.git d68d29516102252f6bf6dc23fb22cef144ca1cb3)
commit 87adedeba5 ("Merge tag 'net-6.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")

 [root@localhost ~]# echo 'p arch_kunwind_consume_entry' > /sys/kernel/debug/tracing/kprobe_events
 [root@localhost ~]# echo 1 > /sys/kernel/debug/tracing/events/kprobes/enable

 Modules linked in: aes_ce_blk aes_ce_cipher ghash_ce sha2_ce virtio_net sha256_arm64 sha1_ce arm_smccc_trng net_failover failover virtio_mmio uio_pdrv_genirq uio sch_fq_codel dm_mod dax configfs
 CPU: 3 PID: 1405 Comm: bash Not tainted 6.8.0-rc6+ #14
 Hardware name: linux,dummy-virt (DT)
 pstate: 604003c5 (nZCv DAIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
 pc : kprobe_breakpoint_handler+0x17c/0x258
 lr : kprobe_breakpoint_handler+0x17c/0x258
 sp : ffff800085d6ab60
 x29: ffff800085d6ab60 x28: ffff0000066f0040 x27: ffff0000066f0b20
 x26: ffff800081fa7b0c x25: 0000000000000002 x24: ffff00000b29bd18
 x23: ffff00007904c590 x22: ffff800081fa6590 x21: ffff800081fa6588
 x20: ffff00000b29bd18 x19: ffff800085d6ac40 x18: 0000000000000079
 x17: 0000000000000001 x16: ffffffffffffffff x15: 0000000000000004
 x14: ffff80008277a940 x13: 0000000000000003 x12: 0000000000000003
 x11: 00000000fffeffff x10: c0000000fffeffff x9 : aa95616fdf80cc00
 x8 : aa95616fdf80cc00 x7 : 205d343137373231 x6 : ffff800080fb48ec
 x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000
 x2 : 0000000000000000 x1 : ffff800085d6a910 x0 : 0000000000000079
 Call trace:
 kprobes: Failed to recover from reentered kprobes.
 kprobes: Dump kprobe:
 .symbol_name = arch_kunwind_consume_entry, .offset = 0, .addr = arch_kunwind_consume_entry+0x0/0x40
 ------------[ cut here ]------------
 kernel BUG at arch/arm64/kernel/probes/kprobes.c:241!
 kprobes: Failed to recover from reentered kprobes.
 kprobes: Dump kprobe:
 .symbol_name = arch_kunwind_consume_entry, .offset = 0, .addr = arch_kunwind_consume_entry+0x0/0x40

Fixes: 1aba06e7b2 ("arm64: stacktrace: factor out kunwind_stack_walk()")
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20240229231620.24846-1-puranjay12@gmail.com
Signed-off-by: Will Deacon <will@kernel.org>
2024-03-04 13:00:00 +00:00
..
pi arm64: kernel: Disable latent_entropy GCC plugin in early C runtime 2023-12-12 11:06:27 +00:00
probes
vdso kbuild: unify vdso_install rules 2023-10-28 21:09:02 +09:00
vdso32 arm64: vdso32: Remove unused vdso32-offsets.h 2024-01-30 11:59:17 +00:00
.gitignore
acpi.c
acpi_numa.c
acpi_parking_protocol.c arm64: smp: Remove dedicated wakeup IPI 2023-09-25 17:15:28 +01:00
alternative.c Merge branches 'for-next/kpti', 'for-next/missing-proto-warn', 'for-next/iss2-decode', 'for-next/kselftest', 'for-next/misc', 'for-next/feat_mops', 'for-next/module-alloc', 'for-next/sysreg', 'for-next/cpucap', 'for-next/acpi', 'for-next/kdump', 'for-next/acpi-doc', 'for-next/doc' and 'for-next/tpidr2-fix', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2023-06-23 18:32:20 +01:00
armv8_deprecated.c arm: Remove now superfluous sentinel elem from ctl_table arrays 2023-10-10 15:22:02 -07:00
asm-offsets.c arm64: fpsimd: Bring cond_yield asm macro in line with new rules 2024-01-12 12:48:27 +00:00
cacheinfo.c
compat_alignment.c
cpu-reset.S
cpu_errata.c arm64: Subscribe Microsoft Azure Cobalt 100 to ARM Neoverse N2 errata 2024-02-15 11:47:22 +00:00
cpu_ops.c
cpufeature.c Generic: 2024-01-17 13:03:37 -08:00
cpuidle.c arm64: Explicitly include correct DT includes 2023-07-31 14:45:38 +01:00
cpuinfo.c arm64: Kill detection of VPIPT i-cache policy 2023-12-05 11:38:03 +00:00
crash_core.c
crash_dump.c
debug-monitors.c
efi-header.S
efi-rt-wrapper.S
efi.c TTY/Serial changes for 6.7-rc1 2023-11-03 15:44:25 -10:00
elfcore.c
entry-common.c arm64: syscall: unmask DAIF earlier for SVCs 2023-08-11 12:23:48 +01:00
entry-fpsimd.S
entry-ftrace.S arm64: ftrace: Enable HAVE_FUNCTION_GRAPH_RETVAL 2023-06-20 18:38:37 -04:00
entry.S arm64: entry: simplify kernel_exit logic 2024-01-18 11:00:09 +00:00
fpsimd.c arm64/sme: Restore SMCR_EL1.EZT0 on exit from suspend 2024-02-20 12:19:16 +00:00
ftrace.c arm64: module: mandate MODULE_PLTS 2023-06-06 17:39:05 +01:00
head.S arm64: mm: get rid of kimage_vaddr global variable 2023-12-12 11:06:28 +00:00
hibernate-asm.S
hibernate.c arm64: hibernate: remove WARN_ON in save_processor_state 2023-06-21 13:33:49 +01:00
hw_breakpoint.c hw_breakpoint: fix single-stepping when using bpf_overflow_handler 2023-08-18 17:04:09 +01:00
hyp-stub.S ARM64: 2023-07-03 15:32:22 -07:00
idle.c arm64: idle: Tag the arm64 idle functions as __cpuidle 2023-09-25 17:15:28 +01:00
idreg-override.c arm64/kernel: Move 'nokaslr' parsing out of early idreg code 2023-12-12 11:13:53 +00:00
image-vars.h efi: move screen_info into efi init code 2023-10-17 16:33:39 +02:00
image.h
io.c
irq.c arm64: irq: set the correct node for shadow call stack 2023-12-13 12:09:00 +00:00
jump_label.c
kaslr.c arm64/kernel: Move 'nokaslr' parsing out of early idreg code 2023-12-12 11:13:53 +00:00
kexec_image.c kexec_file, arm64: print out debugging message if required 2023-12-20 15:02:57 -08:00
kgdb.c
kuser32.S arm64: Update Documentation/arm references 2023-06-12 06:33:48 -06:00
machine_kexec.c kexec_file, arm64: print out debugging message if required 2023-12-20 15:02:57 -08:00
machine_kexec_file.c kexec_file, arm64: print out debugging message if required 2023-12-20 15:02:57 -08:00
Makefile arm64: scs: Disable LTO for SCS patching code 2024-01-30 11:52:46 +00:00
module-plts.c Merge branch 'for-next/cpus_have_const_cap' into for-next/core 2023-10-26 17:10:18 +01:00
module.c arm64: module: rework module VA range selection 2023-06-06 17:39:06 +01:00
mte.c Many singleton patches against the MM code. The patch series which are 2023-11-02 19:38:47 -10:00
paravirt.c
patch-scs.c
patching.c
pci.c arm64: Explicitly include correct DT includes 2023-07-31 14:45:38 +01:00
perf_callchain.c
perf_regs.c
pointer_auth.c
process.c sysctl-6.7-rc1 2023-11-01 20:51:41 -10:00
proton-pack.c arm64: Avoid cpus_have_const_cap() for ARM64_UNMAP_KERNEL_AT_EL0 2023-10-16 14:17:06 +01:00
psci.c
ptrace.c arm64/sve: Lower the maximum allocation for the SVE ptrace regset 2024-02-15 11:48:00 +00:00
reloc_test_core.c
reloc_test_syms.S
relocate_kernel.S
return_address.c
sdei.c arm64: sdei: abort running SDEI handlers during crash 2023-08-04 17:35:33 +01:00
setup.c arm64: convert to arch_cpu_is_hotpluggable() 2023-12-06 12:41:49 +09:00
signal.c arm64/signal: Don't assume that TIF_SVE means we saved SVE state 2024-02-09 16:34:23 +00:00
signal32.c x86/shstk: Add user control-protection fault handler 2023-08-02 15:01:50 -07:00
sigreturn32.S
sleep.S
smccc-call.S
smp.c arm64: Align boot cpucap handling with system cpucap handling 2023-12-13 16:02:01 +00:00
smp_spin_table.c
stacktrace.c arm64: prohibit probing on arch_kunwind_consume_entry() 2024-03-04 13:00:00 +00:00
suspend.c arm64/sme: Restore SME registers on exit from suspend 2024-02-20 12:19:15 +00:00
sys.c
sys32.c
sys_compat.c arm64: Avoid cpus_have_const_cap() for ARM64_WORKAROUND_1542419 2023-10-16 14:17:06 +01:00
syscall.c arm64: syscall: unmask DAIF earlier for SVCs 2023-08-11 12:23:48 +01:00
time.c
topology.c arm64/amu: Use capacity_ref_freq() to set AMU ratio 2023-12-23 15:52:36 +01:00
trace-events-emulation.h
traps.c ARM: 2023-11-02 15:45:15 -10:00
vdso-wrap.S
vdso.c arm64: Avoid cpus_have_const_cap() for ARM64_HAS_BTI 2023-10-16 14:17:04 +01:00
vdso32-wrap.S
vmlinux.lds.S
watchdog_hld.c arm64: enable perf events based hard lockup detector 2023-06-09 17:44:22 -07:00