Skip to content

Commit 41d047a

Browse files
cupermirAlexei Starovoitov
authored andcommitted
bpf/verifier: relax MUL range computation check
MUL instruction required that src_reg would be a known value (i.e. src_reg would be a const value). The condition in this case can be relaxed, since the range computation algorithm used in current code already supports a proper range computation for any valid range value on its operands. Signed-off-by: Cupertino Miranda <cupertino.miranda@oracle.com> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Acked-by: Andrii Nakryiko <andrii.nakryiko@gmail.com> Cc: Yonghong Song <yonghong.song@linux.dev> Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com> Cc: David Faust <david.faust@oracle.com> Cc: Jose Marchesi <jose.marchesi@oracle.com> Cc: Elena Zannoni <elena.zannoni@oracle.com> Link: https://lore.kernel.org/r/20240506141849.185293-6-cupertino.miranda@oracle.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 5ec9a7d commit 41d047a

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

kernel/bpf/verifier.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13902,12 +13902,8 @@ static bool is_safe_to_compute_dst_reg_range(struct bpf_insn *insn,
1390213902
case BPF_AND:
1390313903
case BPF_XOR:
1390413904
case BPF_OR:
13905-
return true;
13906-
13907-
/* Compute range for the following only if the src_reg is const.
13908-
*/
1390913905
case BPF_MUL:
13910-
return src_is_const;
13906+
return true;
1391113907

1391213908
/* Shift operators range is only computable if shift dimension operand
1391313909
* is a constant. Shifts greater than 31 or 63 are undefined. This

0 commit comments

Comments
 (0)