|
@@ -2874,18 +2874,42 @@ static int check_cond_jmp_op(struct bpf_verifier_env *env,
|
|
|
} else if (BPF_SRC(insn->code) == BPF_X && opcode == BPF_JGT &&
|
|
|
dst_reg->type == PTR_TO_PACKET &&
|
|
|
regs[insn->src_reg].type == PTR_TO_PACKET_END) {
|
|
|
+ /* pkt_data' > pkt_end */
|
|
|
find_good_pkt_pointers(this_branch, dst_reg, false);
|
|
|
+ } else if (BPF_SRC(insn->code) == BPF_X && opcode == BPF_JGT &&
|
|
|
+ dst_reg->type == PTR_TO_PACKET_END &&
|
|
|
+ regs[insn->src_reg].type == PTR_TO_PACKET) {
|
|
|
+ /* pkt_end > pkt_data' */
|
|
|
+ find_good_pkt_pointers(other_branch, ®s[insn->src_reg], true);
|
|
|
} else if (BPF_SRC(insn->code) == BPF_X && opcode == BPF_JLT &&
|
|
|
dst_reg->type == PTR_TO_PACKET &&
|
|
|
regs[insn->src_reg].type == PTR_TO_PACKET_END) {
|
|
|
+ /* pkt_data' < pkt_end */
|
|
|
find_good_pkt_pointers(other_branch, dst_reg, true);
|
|
|
+ } else if (BPF_SRC(insn->code) == BPF_X && opcode == BPF_JLT &&
|
|
|
+ dst_reg->type == PTR_TO_PACKET_END &&
|
|
|
+ regs[insn->src_reg].type == PTR_TO_PACKET) {
|
|
|
+ /* pkt_end < pkt_data' */
|
|
|
+ find_good_pkt_pointers(this_branch, ®s[insn->src_reg], false);
|
|
|
+ } else if (BPF_SRC(insn->code) == BPF_X && opcode == BPF_JGE &&
|
|
|
+ dst_reg->type == PTR_TO_PACKET &&
|
|
|
+ regs[insn->src_reg].type == PTR_TO_PACKET_END) {
|
|
|
+ /* pkt_data' >= pkt_end */
|
|
|
+ find_good_pkt_pointers(this_branch, dst_reg, true);
|
|
|
} else if (BPF_SRC(insn->code) == BPF_X && opcode == BPF_JGE &&
|
|
|
dst_reg->type == PTR_TO_PACKET_END &&
|
|
|
regs[insn->src_reg].type == PTR_TO_PACKET) {
|
|
|
+ /* pkt_end >= pkt_data' */
|
|
|
find_good_pkt_pointers(other_branch, ®s[insn->src_reg], false);
|
|
|
+ } else if (BPF_SRC(insn->code) == BPF_X && opcode == BPF_JLE &&
|
|
|
+ dst_reg->type == PTR_TO_PACKET &&
|
|
|
+ regs[insn->src_reg].type == PTR_TO_PACKET_END) {
|
|
|
+ /* pkt_data' <= pkt_end */
|
|
|
+ find_good_pkt_pointers(other_branch, dst_reg, false);
|
|
|
} else if (BPF_SRC(insn->code) == BPF_X && opcode == BPF_JLE &&
|
|
|
dst_reg->type == PTR_TO_PACKET_END &&
|
|
|
regs[insn->src_reg].type == PTR_TO_PACKET) {
|
|
|
+ /* pkt_end <= pkt_data' */
|
|
|
find_good_pkt_pointers(this_branch, ®s[insn->src_reg], true);
|
|
|
} else if (is_pointer_value(env, insn->dst_reg)) {
|
|
|
verbose("R%d pointer comparison prohibited\n", insn->dst_reg);
|