pipeline: support action annotations
[dpdk.git] / lib / bpf / bpf_validate.c
index 9214f15..853279f 100644 (file)
@@ -661,8 +661,15 @@ eval_alu(struct bpf_verifier *bvf, const struct ebpf_insn *ins)
 
        op = BPF_OP(ins->code);
 
+       /* Allow self-xor as way to zero register */
+       if (op == BPF_XOR && BPF_SRC(ins->code) == BPF_X &&
+           ins->src_reg == ins->dst_reg) {
+               eval_fill_imm(&rs, UINT64_MAX, 0);
+               eval_fill_imm(rd, UINT64_MAX, 0);
+       }
+
        err = eval_defined((op != EBPF_MOV) ? rd : NULL,
-                       (op != BPF_NEG) ? &rs : NULL);
+                          (op != BPF_NEG) ? &rs : NULL);
        if (err != NULL)
                return err;
 
@@ -1115,7 +1122,7 @@ eval_jcc(struct bpf_verifier *bvf, const struct ebpf_insn *ins)
                eval_jsgt_jsle(trd, trs, frd, frs);
        else if (op == EBPF_JSLE)
                eval_jsgt_jsle(frd, frs, trd, trs);
-       else if (op == EBPF_JLT)
+       else if (op == EBPF_JSLT)
                eval_jslt_jsge(trd, trs, frd, frs);
        else if (op == EBPF_JSGE)
                eval_jslt_jsge(frd, frs, trd, trs);