Re: [PATCH v7 10/11] arm64, crypto/lib: Annotate leaf functions with CFI info

From: sashiko-bot

Date: Fri Sep 18 2026 - 18:58:27 EST


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] arm64: CFI start directive placed before function alignment corrupts DWARF FDE bounds
--

commit 498fccd9732a9f4edcb2b385432263d6681de459
Author: Dylan Hatch <dylanbhatch@xxxxxxxxxx>

arm64, crypto/lib: Annotate leaf functions with CFI info

This commit adds simple CFI annotations to assembly leaf functions so that
the link register can be recovered by the unwinder. It introduces the
SYM_LEAF_FUNC_START macro family for these annotations.

> diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/linkage.h
> index d1f7a16729d25..c4377e6ba0a67 100644
> --- a/arch/arm64/include/asm/linkage.h
> +++ b/arch/arm64/include/asm/linkage.h
> @@ -47,4 +53,27 @@
>
> #define __bss_pgtbl __section(".bss..pgtbl") __aligned(PAGE_SIZE)
>
> +/*
> + * SYM_[TYPED_]LEAF_FUNC_[START|END] macros add CFI minimal CFI directives
> + * allowing .sframe data to be generated for functions which do not modify the
> + * LR (x30). Unwind data will not be correct if these macros are used on
> + * non-leaf functions, as additional CFI directives would be necessary in such
> + * cases.
> + */
> +#define SYM_LEAF_FUNC_START(name) \
> + .cfi_startproc ; \
> + SYM_FUNC_START(name)

[Severity: Medium]
Will placing .cfi_startproc before SYM_FUNC_START() cause the DWARF FDE bounds
to include alignment padding bytes?

Since SYM_FUNC_START() emits the .balign directive for the function,
placing .cfi_startproc before it captures this padding. This can misalign
the FDE start address relative to the function symbol, which could confuse
stack unwinders like the sframe unwinder.

Should the .cfi_startproc directive be emitted after the alignment within
SYM_FUNC_START() completes?

> +
> +#define SYM_LEAF_FUNC_END(name) \
> + .cfi_endproc ; \
> + SYM_FUNC_END(name)
> +
> +#define SYM_LEAF_FUNC_START_LOCAL(name) \
> + .cfi_startproc ; \
> + SYM_FUNC_START_LOCAL(name)

[Severity: Medium]
Does the same alignment issue apply to SYM_LEAF_FUNC_START_LOCAL()? The
.cfi_startproc directive is emitted before SYM_FUNC_START_LOCAL(), which
also handles function alignment.

> +
> +#define SYM_TYPED_LEAF_FUNC_START(name) \
> + .cfi_startproc ; \
> + SYM_TYPED_FUNC_START(name)

[Severity: Medium]
Could this also lead to misaligned FDE start addresses for typed leaf
functions, since .cfi_startproc is placed before SYM_TYPED_FUNC_START()
alignment?

> +
> #endif

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260918224157.1471085-1-dylanbhatch@xxxxxxxxxx?part=10