Re: [PATCH v2] s390: add CFI directives for call_on_stack

From: Alexander Gordeev

Date: Tue Dec 01 2026 - 06:26:42 EST


On Mon, Nov 30, 2026 at 01:46:28PM -0800, Stephen Brennan wrote:
> When debugging s390 on drgn, we experience two issues. First, when a
> panic is triggered on CPU 0, drgn is unable to unwind past a stack
> switching event[1,2]. Second, drgn is unable to unwind through an
> interrupt exception frame.
>
> It turns out that the reason for both is the generated call_on_stack()
> assembly. It modifies %r15 (the stack pointer) without any CFI
> directives describing this change. Thus, the compiler-generated CFI is
> wrong, and drgn tries to unwind using rules based on the wrong SP value.
>
> To resolve this, use a callee-saved register to store the CFA before the
> call. Then, emit a CFI directive describing the change. So long as DWARF
> CFI is used to unwind all leaf functions, the register value should be
> recoverable, so unwinders will be able to use it to determine the CFA
> and continue to the new stack.
>
> I've tested this only in a QEMU VM using drgn's vmtest framework.
> With the patch, drgn is able to unwind through two stack changes: the
> change to the IRQ stack, and the change to the CPU0 nodat_stack during a
> panic on CPU 0.
>
> [1]: https://github.com/osandov/drgn/blob/97b613c23bd4d100a61b3b06fb1b5097fcef9f61/vmtest/enter_kdump.py#L69-L74
> [2]: https://github.com/osandov/drgn/blob/97b613c23bd4d100a61b3b06fb1b5097fcef9f61/tests/linux_kernel/vmcore/test_vmcore.py#L19-L25
>
> Signed-off-by: Stephen Brennan <stephen.s.brennan@xxxxxxxxxx>
> ---
> arch/s390/include/asm/stacktrace.h | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)

Applied, thanks!