Re: [PATCH v5 0/8] unwind, arm64: add sframe unwinder for kernel

Dylan Hatch <[email protected]>
Newsgroups org.kernel.vger.live-patching,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-toolchains
Message-ID <CADBMgpwDzrQU289fRXCRvSiCo3noOTy6=q8C58sLPrT_KO+=UQ@mail.gmail.com>
On Thu, Apr 30, 2026 at 3:11 AM Jens Remus <[email protected]> wrote:
>
> On 4/28/2026 8:36 PM, Dylan Hatch wrote:
> > Implement a generic kernel sframe-based [1] unwinder. The main goal is
> > to improve reliable stacktrace on arm64 by unwinding across exception
> > boundaries.
>
> Please add support to initialize the optional sframe unwinder debug
> information.  Either in the appropriate patches in this series or as a
> separate patch.

Sounds good, I'll add this in as a separate patch in the next version.

>
> Note that for the module case I wonder whether it would be preferable
> to somehow indicate that it is a module name in the string, e.g.
> "(<module-name>)" or "<module-name> (module)"?

I don't have a strong preference, though I agree it makes sense to
indicate that the section is from a module. For now I'll add the
parentheses "(<module-name>)".

>
> diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c
> --- a/kernel/unwind/sframe.c
> +++ b/kernel/unwind/sframe.c
> @@ -1028,6 +1028,8 @@ void __init init_sframe_table(void)
>         kernel_sfsec.text_start         = (unsigned long)_stext;
>         kernel_sfsec.text_end           = (unsigned long)_etext;
>
> +       dbg_init(&kernel_sfsec);
> +
>         if (WARN_ON(sframe_read_header(&kernel_sfsec)))
>                 return;
>         if (WARN_ON(sframe_validate_section(&kernel_sfsec)))
> @@ -1047,6 +1049,8 @@ void sframe_module_init(struct module *mod, void *sframe, size_t sframe_size,
>         sec->text_start   = (unsigned long)text;
>         sec->text_end     = (unsigned long)text + text_size;
>
> +       dbg_init(sec);
> +
>         if (WARN_ON(sframe_read_header(sec)))
>                 return;
>         if (WARN_ON(sframe_validate_section(sec)))
> diff --git a/kernel/unwind/sframe_debug.h b/kernel/unwind/sframe_debug.h
> --- a/kernel/unwind/sframe_debug.h
> +++ b/kernel/unwind/sframe_debug.h
> @@ -32,6 +32,18 @@ static inline void dbg_init(struct sframe_section *sec)
>         struct mm_struct *mm = current->mm;
>         struct vm_area_struct *vma;
>
> +       if (sec->sec_type == SFRAME_KERNEL) {
> +               if (sec == &kernel_sfsec) {
> +                       sec->filename = kstrdup("(vmlinux)", GFP_KERNEL);
> +               } else {
> +                       struct module *mod = container_of(sec, struct module,
> +                                                         arch.sframe_sec);
> +                       sec->filename = kstrdup(mod->name, GFP_KERNEL);
> +               }
> +
> +               return;
> +       }
> +
>         guard(mmap_read_lock)(mm);
>         vma = vma_lookup(mm, sec->sframe_start);
>         if (!vma)
>
> Regards,
> Jens
> --
> Jens Remus
> Linux on Z Development (D3303)
> [email protected] / [email protected]
>
> IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
> IBM Data Privacy Statement: https://www.ibm.com/privacy/
>

Thanks for the suggestion,
Dylan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.