diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2026-10-20 18:13:17 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-20 20:54:25 +0000 |
| commit | fc85015a5e862c975c0de092894e8c823ab3f1dc (patch) | |
| tree | 24befe80044437bff52c059202f906aa5afbf8f9 /tools/perf/scripts/python/stackcollapse.py | |
| parent | cff94a3d78d8cc12ceaf60aa9272aac422b1dc39 (diff) | |
bpf, arm64: Support unwind_goto and unwind_exit
bpf arm64
call inner bl inner
mov x8, x0
unwind_goto pad
w0 = w6 mov w8, w19
Like on x86 unwind_goto is an extable entry and no code.
unwind_exit returns to the pad past 'mov x8, x0'. That's fine: r0 is x8,
and the epilogue of the callee copies it to x0 and leaves x8 as it is.
With pointer authentication LR in the frame record is signed. unwind_exit
doesn't sign the address of the pad. It looks up the offset of the pad from
its return address. Then it's the epilogue as it is, and the offset is
added to LR after autiasp:
stp x8, x1, [sp, #-16]!
ldr x0, [x29, #8]
bl bpf_unwind_fixup
mov x10, x0
ldp x8, x1, [sp], #16
...
ldp x29, x30, [sp], #16
mov x0, x8
autiasp
add x30, x30, x10
ret
So LR is authenticated like in exit, and the frame record stays as it is.
bpf_unwind_fixup() strips the signature for the lookup.
RET is not subject to BTI.
r0 and r2 are what a subprog returns, so x8 and x1 are saved around the
lookup.
Like on x86 the offset is 0 when the kernel called the subprog as
a callback, and unwind_exit of the main prog is exit, unless it's
an extension.
The private stack pointer is in a callee saved register. Unlike x86 there
is nothing to undo after the call.
Tested in qemu with -cpu max and -cpu cortex-a72, i.e. with and without
pointer authentication.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261020181320.1284798-4-alexei.starovoitov@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
