Commit 4a2ff55a authored by Daniel Borkmann's avatar Daniel Borkmann Committed by David S. Miller

bpf: reset id on CONST_IMM transition

Whenever we set the register to the type CONST_IMM, we currently don't
reset the id to 0. id member is not used in CONST_IMM case, so don't
let it become stale, where pruning won't be able to match later on.
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d25da6ca
...@@ -1952,6 +1952,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) ...@@ -1952,6 +1952,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)
*/ */
regs[insn->dst_reg].type = CONST_IMM; regs[insn->dst_reg].type = CONST_IMM;
regs[insn->dst_reg].imm = insn->imm; regs[insn->dst_reg].imm = insn->imm;
regs[insn->dst_reg].id = 0;
regs[insn->dst_reg].max_value = insn->imm; regs[insn->dst_reg].max_value = insn->imm;
regs[insn->dst_reg].min_value = insn->imm; regs[insn->dst_reg].min_value = insn->imm;
regs[insn->dst_reg].min_align = calc_align(insn->imm); regs[insn->dst_reg].min_align = calc_align(insn->imm);
...@@ -2409,6 +2410,7 @@ static int check_ld_imm(struct bpf_verifier_env *env, struct bpf_insn *insn) ...@@ -2409,6 +2410,7 @@ static int check_ld_imm(struct bpf_verifier_env *env, struct bpf_insn *insn)
regs[insn->dst_reg].type = CONST_IMM; regs[insn->dst_reg].type = CONST_IMM;
regs[insn->dst_reg].imm = imm; regs[insn->dst_reg].imm = imm;
regs[insn->dst_reg].id = 0;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment