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

From: Heiko Carstens

Date: Wed Nov 18 2026 - 05:13:46 EST


Hi Stephen,

On Mon, Nov 16, 2026 at 10:02:57AM -0800, Stephen Brennan wrote:
> Stephen Brennan <stephen.s.brennan@xxxxxxxxxx> writes:
> > 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 %r10 (a callee-saved register) to store the CFA in
> > a temporary register. Then, emit a CFI directive describing the change.
> > So long as DWARF CFI is used to unwind all leaf functions, the value of
> > %r10 should be recoverable, and 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>
>
> Hello,
>
> Following up on this patch. Is there any additional verification I can
> work on to help facilitate review?

Sorry for the late reply and thanks for providing the fix!

Please be a bit more patient, your patch was not forgotten, and
nothing needs to be done on your side. Might take another couple
of days before I get to it.