]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: arm64: simplify exception table handling
authorPuranjay Mohan <puranjay@kernel.org>
Thu, 11 Sep 2025 14:58:00 +0000 (14:58 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 11 Sep 2025 20:00:43 +0000 (13:00 -0700)
commit0460484244e1fa4a0cdbc9ed76c838fc528134d3
treed152d78394c5504178b1f183b5b7a977b2d8b78c
parent5d87e96a4971760c83e554c1d3ca99986d4f9b47
bpf: arm64: simplify exception table handling

BPF loads with BPF_PROBE_MEM(SX) can load from unsafe pointers and the
JIT adds an exception table entry for the JITed instruction which allows
the exeption handler to set the destination register of the load to zero
and continue execution from the next instruction.

As all arm64 instructions are AARCH64_INSN_SIZE size, the exception
handler can just increment the pc by AARCH64_INSN_SIZE without needing
the exact address of the instruction following the the faulting
instruction.

Simplify the exception table usage in arm64 JIT by only saving the
destination register in ex->fixup and drop everything related to
the fixup_offset. The fault handler is modified to add AARCH64_INSN_SIZE
to the pc.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Acked-by: Xu Kuohai <xukuohai@huawei.com>
Link: https://lore.kernel.org/r/20250911145808.58042-2-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/arm64/net/bpf_jit_comp.c