]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf, arm64: support exceptions
authorPuranjay Mohan <puranjay12@gmail.com>
Thu, 1 Feb 2024 12:52:25 +0000 (12:52 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 27 Feb 2024 21:54:17 +0000 (13:54 -0800)
commit22fc0e80aeb5c0c1377e6c02d7248f8fbf5df7fc
tree4a75076e5895a08e735de95e9e5c0ba31d21f4c9
parente74cb1b422131615a0fe3bedd4ab2e38b7442d10
bpf, arm64: support exceptions

The prologue generation code has been modified to make the callback
program use the stack of the program marked as exception boundary where
callee-saved registers are already pushed.

As the bpf_throw function never returns, if it clobbers any callee-saved
registers, they would remain clobbered. So, the prologue of the
exception-boundary program is modified to push R23 and R24 as well,
which the callback will then recover in its epilogue.

The Procedure Call Standard for the Arm 64-bit Architecture[1] states
that registers r19 to r28 should be saved by the callee. BPF programs on
ARM64 already save all callee-saved registers except r23 and r24. This
patch adds an instruction in prologue of the  program to save these
two registers and another instruction in the epilogue to recover them.

These extra instructions are only added if bpf_throw() is used. Otherwise
the emitted prologue/epilogue remains unchanged.

[1] https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Link: https://lore.kernel.org/r/20240201125225.72796-3-puranjay12@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/arm64/net/bpf_jit_comp.c
tools/testing/selftests/bpf/DENYLIST.aarch64