summaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorXu Kuohai <xukuohai@huawei.com>2023-08-15 11:41:56 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2023-08-18 15:46:18 +0200
commitc32b6ee514d26dc6c40c45984e534b2d87fba917 (patch)
treec1b3b5c2d76834c7c396a609eadf88aedfb30ecd /arch/arm64
parent1104247f3f97916f0afc29b73112c97affbfdbd2 (diff)
downloadlinux-stable-c32b6ee514d26dc6c40c45984e534b2d87fba917.tar.gz
linux-stable-c32b6ee514d26dc6c40c45984e534b2d87fba917.tar.bz2
linux-stable-c32b6ee514d26dc6c40c45984e534b2d87fba917.zip
bpf, arm64: Support 32-bit offset jmp instruction
Add support for 32-bit offset jmp instructions. Given the arm64 direct jump range is +-128MB, which is large enough for BPF prog, jumps beyond this range are not supported. Signed-off-by: Xu Kuohai <xukuohai@huawei.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Tested-by: Florent Revest <revest@chromium.org> Acked-by: Florent Revest <revest@chromium.org> Link: https://lore.kernel.org/bpf/20230815154158.717901-6-xukuohai@huaweicloud.com
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/net/bpf_jit_comp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 1d35acb880dc..924b8ef2e46a 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -982,7 +982,11 @@ emit_bswap_uxt:
/* JUMP off */
case BPF_JMP | BPF_JA:
- jmp_offset = bpf2a64_offset(i, off, ctx);
+ case BPF_JMP32 | BPF_JA:
+ if (BPF_CLASS(code) == BPF_JMP)
+ jmp_offset = bpf2a64_offset(i, off, ctx);
+ else
+ jmp_offset = bpf2a64_offset(i, imm, ctx);
check_imm26(jmp_offset);
emit(A64_B(jmp_offset), ctx);
break;