Skip to content

Commit c32b6ee

Browse files
Xu Kuohaiborkmann
authored andcommitted
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
1 parent 1104247 commit c32b6ee

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

arch/arm64/net/bpf_jit_comp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,11 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
982982

983983
/* JUMP off */
984984
case BPF_JMP | BPF_JA:
985-
jmp_offset = bpf2a64_offset(i, off, ctx);
985+
case BPF_JMP32 | BPF_JA:
986+
if (BPF_CLASS(code) == BPF_JMP)
987+
jmp_offset = bpf2a64_offset(i, off, ctx);
988+
else
989+
jmp_offset = bpf2a64_offset(i, imm, ctx);
986990
check_imm26(jmp_offset);
987991
emit(A64_B(jmp_offset), ctx);
988992
break;

0 commit comments

Comments
 (0)