Skip to content

Commit c272943

Browse files
puranjaymohanKernel Patches Daemon
authored andcommitted
bpf: arm64: Add support for indirect jumps
Add support for a new instruction BPF_JMP|BPF_X|BPF_JA, SRC=0, DST=Rx, off=0, imm=0 which does an indirect jump to a location stored in Rx. The register Rx should have type PTR_TO_INSN. This new type assures that the Rx register contains a value (or a range of values) loaded from a correct jump table – map of type instruction array. ARM64 JIT supports indirect jumps to all registers through the A64_BR() macro, use it to implement this new instruction. Signed-off-by: Puranjay Mohan <[email protected]> Reviewed-by: Anton Protopopov <[email protected]>
1 parent 027d963 commit c272943

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,10 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
14521452
emit(A64_ASR(is64, dst, dst, imm), ctx);
14531453
break;
14541454

1455+
/* JUMP reg */
1456+
case BPF_JMP | BPF_JA | BPF_X:
1457+
emit(A64_BR(dst), ctx);
1458+
break;
14551459
/* JUMP off */
14561460
case BPF_JMP | BPF_JA:
14571461
case BPF_JMP32 | BPF_JA:

0 commit comments

Comments
 (0)