sst-linux/arch
Jann Horn d224ed6e90 x86/dumpstack: Fix inaccurate unwinding from exception stacks due to misplaced assignment
[ Upstream commit 2c118f50d7fd4d9aefc4533a26f83338b2906b7a ]

Commit:

  2e4be0d011f2 ("x86/show_trace_log_lvl: Ensure stack pointer is aligned, again")

was intended to ensure alignment of the stack pointer; but it also moved
the initialization of the "stack" variable down into the loop header.

This was likely intended as a no-op cleanup, since the commit
message does not mention it; however, this caused a behavioral change
because the value of "regs" is different between the two places.

Originally, get_stack_pointer() used the regs provided by the caller; after
that commit, get_stack_pointer() instead uses the regs at the top of the
stack frame the unwinder is looking at. Often, there are no such regs at
all, and "regs" is NULL, causing get_stack_pointer() to fall back to the
task's current stack pointer, which is not what we want here, but probably
happens to mostly work. Other times, the original regs will point to
another regs frame - in that case, the linear guess unwind logic in
show_trace_log_lvl() will start unwinding too far up the stack, causing the
first frame found by the proper unwinder to never be visited, resulting in
a stack trace consisting purely of guess lines.

Fix it by moving the "stack = " assignment back where it belongs.

Fixes: 2e4be0d011f2 ("x86/show_trace_log_lvl: Ensure stack pointer is aligned, again")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250325-2025-03-unwind-fixes-v1-2-acd774364768@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:33:35 +02:00
..
alpha alpha/elf: Fix misc/setarch test of util-linux by removing 32bit support 2025-03-28 21:58:51 +01:00
arc ARC: build: Try to guess GCC variant of cross compiler 2025-01-09 13:30:05 +01:00
arm ARM: dts: imx6qdl-apalis: Fix poweroff on Apalis iMX6 2025-04-07 10:05:46 +02:00
arm64 arm64: dts: rockchip: fix u2phy1_host status for NanoPi R4S 2025-03-28 21:59:02 +01:00
csky mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
hexagon hexagon: Fix unbalanced spinlock in die() 2025-02-21 13:49:25 +01:00
ia64 mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
loongarch LoongArch: Convert unreachable() to BUG() 2025-03-13 12:53:11 +01:00
m68k m68k: vga: Fix I/O defines 2025-02-21 13:49:38 +01:00
microblaze microblaze: Export xmb_manager functions 2024-12-14 19:53:20 +01:00
mips ptrace: Introduce exception_ip arch hook 2025-03-07 16:56:51 +01:00
nios2 mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
openrisc mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
parisc parisc/ftrace: Fix function graph tracing disablement 2024-12-14 19:54:02 +01:00
powerpc Revert "KVM: PPC: e500: Mark "struct page" dirty in kvmppc_e500_shadow_map()" 2025-03-13 12:53:24 +01:00
riscv riscv/futex: sign extend compare value in atomic cmpxchg 2025-03-07 16:56:50 +01:00
s390 s390/traps: Fix test_monitor_call() inline assembly 2025-03-13 12:53:15 +01:00
sh sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2024-12-14 19:54:03 +01:00
sparc mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
um um: Always dump trace for specified task in show_stack 2024-12-14 19:54:07 +01:00
x86 x86/dumpstack: Fix inaccurate unwinding from exception stacks due to misplaced assignment 2025-04-10 14:33:35 +02:00
xtensa mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
.gitignore
Kconfig Revert "mm: mmap: allow for the maximum number of bits for randomizing mmap_base by default" 2024-06-27 13:46:24 +02:00