Re: [PATCH v2 6/6] unwind: arm64: Add reliable stacktrace with sframe unwinder.

Indu Bhagat <[email protected]> Tue, 18 Nov 2025 23:12:01 -0800
Newsgroups org.kernel.vger.linux-toolchains,org.kernel.vger.linux-kernel,org.kernel.vger.live-patching
Message-ID <[email protected]>
On 11/18/25 7:17 PM, Dylan Hatch wrote:
>> For sframe v3, I believe Indu is planning to add support for marking the
>> outermost frame.  That would be one definitive way to know that the
>> stack trace made it to the end.
> How would this work? Is there a way of determining at compile time
> which functions would end up being the outermost frame?

No, the compiler does not emit such a marker.

SFrame information is generated by assembler using the .cfi_* 
directives.  For the outermost functions, they need to be marked with a:
    .cfi_undefined RA
where RA is the default return address register for the ABI.

This mechanism is formalised in the DWARF standard:
"If a Return Address register is defined in the virtual unwind table, 
and its rule is undefined (for example, by DW_CFA_undefined), then there 
is no return address and no call address, and the virtual unwind of 
stack activations is complete."

SFrame relies on this to emit a marker for identifying outermost frame.