Skip to content

Commit

Permalink
MIPS: eBPF32: build_one_insn(): enable BPF_LD|BPF_DW|BPF_IMM
Browse files Browse the repository at this point in the history
Also stop enforcing (insn->src_reg == 0) to allow special verifier insns
such as BPF_LD_MAP_FD(BPF_REG_2, 0).

Test jited within test_bpf up from 21 to 60+ and passing.

But hit this error:
test_bpf: torvalds#204 ALU_END_FROM_BE 64: 0x0123456789abcdef -> 0x89abcdef jited:1
Reserved instruction in kernel code[#1]:
  • Loading branch information
Tony Ambardar authored and Tony Ambardar committed Jun 1, 2021
1 parent a40dc16 commit a7012a2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions arch/mips/net/ebpf_jit32.c
Expand Up @@ -1556,14 +1556,11 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
emit_instr(ctx, nop);
break;
case BPF_LD | BPF_DW | BPF_IMM:
UNSUPPORTED;
if (insn->src_reg != 0)
return -EINVAL;
dst = ebpf_to_mips_reg(ctx, insn, REG_DST);
if (dst < 0)
return dst;
t64 = ((u64)(u32)insn->imm) | ((u64)(insn + 1)->imm << 32);
emit_const_to_reg(ctx, dst, t64);
gen_imm_to_reg(insn, LO(dst), ctx);
gen_imm_to_reg(insn+1, HI(dst), ctx);
return 2; /* Double slot insn */

case BPF_JMP | BPF_CALL:
Expand Down

0 comments on commit a7012a2

Please sign in to comment.