mirror-linux/arch/s390
Jens Remus 489e96651d s390/stacktrace: Do not fallback to RA register
The logic to fallback to the return address (RA) register value in
the topmost frame when stack tracing using back chain is broken in
multiple ways:

When assuming the RA register 14 has not been saved yet one must assume
that a new user stack frame has not been allocated either.  Therefore
the back chain would not contain the stack pointer (SP) at entry, but
the caller's SP at its entry instead.

Therefore when falling back to the RA register 14 value it would also be
necessary to fallback to the SP register 15 value.  Otherwise an invalid
combination of RA register 14 and caller's SP at its entry (from the
back chain) is used.

In the topmost frame the back chain contains either the caller's SP at
its entry (before having allocated a new stack frame in the prologue),
the SP at entry (after having allocated a new stack frame), or an
uninitialized value (during static/dynamic stack allocation).  In both
cases where the back chain is valid either the caller or prologue must
have saved its respective RA to the respective frame.  Therefore, if the
RA obtained from the frame pointed to by the back chain is invalid, this
does not indicate that the IP in the topmost frame is still early in the
prologue and the RA has not been saved.

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2025-12-14 11:03:58 +01:00
..
appldata s390: Remove KMSG_COMPONENT macro 2025-11-24 11:45:21 +01:00
boot s390/boot: Use entire page for PTEs 2025-12-07 16:15:19 +01:00
configs This update includes the following changes: 2025-12-03 11:28:38 -08:00
crypto Crypto library updates for 6.19 2025-12-02 18:01:03 -08:00
hypfs Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
include s390/ipl: Clear SBP flag when bootprog is set 2025-12-14 11:03:57 +01:00
kernel s390/stacktrace: Do not fallback to RA register 2025-12-14 11:03:58 +01:00
kvm ARM: 2025-12-05 17:01:20 -08:00
lib s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
mm KVM: s390: Fix gmap_helper_zap_one_page() again 2025-12-08 13:06:14 +01:00
net bpf-next-6.19 2025-12-03 16:54:54 -08:00
pci s390/pci: Annotate lock context imbalance in zpci_release_device() 2025-12-14 11:03:58 +01:00
purgatory kbuild: Add '-fms-extensions' to areas with dedicated CFLAGS 2025-10-30 21:26:28 -04:00
tools s390: Add Dat-Enhancement facility 1 to architecture level set 2025-11-06 14:12:30 +01:00
Kbuild
Kconfig s390/pci: Migrate s390 IRQ logic to IRQ domain API 2025-12-07 16:15:23 +01:00
Kconfig.debug s390/mm: Add configurable STRICT_MM_TYPECHECKS 2025-03-11 15:27:34 +01:00
Makefile s390 updates for 6.19 merge window 2025-12-02 16:37:00 -08:00
Makefile.postlink kbuild: Create intermediate vmlinux build with relocations preserved 2025-03-17 00:29:50 +09:00