[RFC PATCH v2 15/30] arm64: Add DWARF CFI annotations to entry, ftrace, EFI, BPF, and KASAN

bot+bpf-ci at kernel.org bot+bpf-ci at kernel.org
Tue Nov 24 23:06:15 PST 2026


> arm64: Add DWARF CFI annotations to entry, ftrace, EFI, BPF, and KASAN

TL;DR: Commit message only: it claims bpf_jit_supports_exceptions() is changed
but only a comment is, possibly premature before the unwinder commit; it also
omits an unconditional xzr store in return_to_handler.

>     arm64: Add DWARF CFI annotations to entry, ftrace, EFI, BPF, and KASAN
>
>     Annotate arm64 hand-written assembly helpers with .cfi_* directives
>     under CONFIG_UNWINDER_DWARF_CFI so runtime .eh_frame unwinding traverses
>     call_on_irq_stack(), __efi_rt_asm_wrapper(), return_to_handler() (and
>     exports ftrace_caller_end), __hwasan_tag_mismatch(), and
>     arch_bpf_timed_may_goto(), and allow bpf_jit_supports_exceptions() when
>     CONFIG_UNWINDER_DWARF_CFI is enabled.
>
>     Signed-off-by: Ian Rogers <irogers at google.com>

The commit message says the patch will "allow bpf_jit_supports_exceptions()
when CONFIG_UNWINDER_DWARF_CFI is enabled", but the arm64 hunk only
rewrites the comment:

> diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
> --- a/arch/arm64/net/bpf_jit_comp.c
> +++ b/arch/arm64/net/bpf_jit_comp.c
> @@ -3909,10 +3909,11 @@ u64 bpf_arch_uaddress_limit(void)
>  
>  bool bpf_jit_supports_exceptions(void)
>  {
> -	/* We unwind through both kernel frames starting from within bpf_throw
> -	 * call and BPF frames. Therefore we require FP unwinder to be enabled
> -	 * to walk kernel frames and reach BPF frames in the stack trace.
> -	 * ARM64 kernel is always compiled with CONFIG_FRAME_POINTER=y
> +	/*
> +	 * We unwind through both kernel frames starting from within bpf_throw
> +	 * call and BPF frames. Both UNWINDER_FRAME_POINTER and
> +	 * UNWINDER_DWARF_CFI preserve x29 across kernel frames and walk
> +	 * JITed BPF frame records.
>  	 */
>  	return true;
>  }

bpf_jit_supports_exceptions() returned true unconditionally before this
patch and still does.  The wording looks like it came from the x86 patch in
this series, which added "|| IS_ENABLED(CONFIG_UNWINDER_DWARF_CFI)".

There is also an ordering question.  At this commit arm64 has neither
UNWINDER_FRAME_POINTER nor UNWINDER_DWARF_CFI; both arrive in the next
commit, 14d0cf0eeab5 ("arm64/unwind: Add Minimal DWARF CFI kernel
unwinder").  The removed sentence "ARM64 kernel is always compiled with
CONFIG_FRAME_POINTER=y" is still true here and stops being true only in that
commit.  Should this comment change move there?

The message also says the annotations are added "under
CONFIG_UNWINDER_DWARF_CFI", but one change in return_to_handler is not under
that option:

> @@ -338,12 +352,24 @@ SYM_CODE_START(return_to_handler)
> -	/* Save the callsite's FP */
> +	/* Save the callsite's FP and clear unused LR slot in ftrace_regs */
>  	str	x29, [sp, #FREGS_FP]
> +	str	xzr, [sp, #FREGS_LR]
> +#ifdef CONFIG_UNWINDER_DWARF_CFI

The str xzr store runs in every CONFIG_FUNCTION_GRAPH_TRACER build.  It
looks harmless, since ftrace_partial_regs() used to copy stack garbage into
regs->regs[30] for kprobe_multi return programs and now copies 0, but it is
not mentioned in the changelog.

Could the changelog say that the bpf_jit_comp.c part only updates the
justification ahead of the unwinder-choice commit (or move it there), and
mention the unconditional FREGS_LR store?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/45561209846


More information about the linux-riscv mailing list