Re: [PATCH v2 0/6] unwind, arm64: add sframe unwinder for kernel

From: Song Liu

Date: Mon Sep 29 2025 - 15:46:20 EST


On Thu, Sep 4, 2025 at 3:39 PM Dylan Hatch <dylanbhatch@xxxxxxxxxx> wrote:
>
> This patchset implements a generic kernel sframe-based [1] unwinder.
> The main goal is to support reliable stacktraces on arm64.
>
> On x86 orc unwinder provides reliable stacktraces. But arm64 misses the
> required support from objtool: it cannot generate orc unwind tables for
> arm64.
>
> Currently, there's already a sframe unwinder proposed for userspace: [2].
> Since the sframe unwind table algorithm is similar, these two proposals
> could integrate common functionality in the future.
>
> Currently, only GCC supports sframe.
>
> These patches are based on v6.17-rc4 and are available on github [3].
>
> Ref:
> [1]: https://sourceware.org/binutils/docs/sframe-spec.html
> [2]: https://lore.kernel.org/lkml/cover.1730150953.git.jpoimboe@xxxxxxxxxx/
> [3]: https://github.com/dylanbhatch/linux/tree/sframe-v2

I run the following test on this sframe-v2 branch:

bpftrace -e 'kprobe:security_file_open {printf("%s",
kstack);@count+=1; if (@count > 1) {exit();}}'

security_file_open+0
bpf_prog_eaca355a0dcdca7f_kprobe_security_file_open_1+16641632@./bpftrace.bpf.o:0
path_openat+1892
do_filp_open+132
do_open_execat+84
alloc_bprm+44
do_execveat_common.isra.0+116
__arm64_sys_execve+72
invoke_syscall+76
el0_svc_common.constprop.0+68
do_el0_svc+32
el0_svc+56
el0t_64_sync_handler+152
el0t_64_sync+388

This looks wrong. The right call trace should be:

do_filp_open
=> path_openat
=> vfs_open
=> do_dentry_open
=> security_file_open
=> bpf_prog_eaca355a0dcdca7f_...

I am not sure whether this is just a problem with the bpf program,
or also with something else.

Thanks,
Song