mirror of
https://github.com/torvalds/linux
synced 2024-07-22 11:10:46 +00:00
bpf/verifier: improve XOR and OR range computation
Range for XOR and OR operators would not be attempted unless src_reg would resolve to a single value, i.e. a known constant value. This condition is unnecessary, and the following XOR/OR operator handling could compute a possible better range. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Cupertino Miranda <cupertino.miranda@oracle.com Acked-by: Eduard Zingerman <eddyz87@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> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com> Link: https://lore.kernel.org/r/20240506141849.185293-4-cupertino.miranda@oracle.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
0922c78f59
commit
138cc42c05
|
@ -13900,12 +13900,12 @@ static bool is_safe_to_compute_dst_reg_range(struct bpf_insn *insn,
|
|||
case BPF_ADD:
|
||||
case BPF_SUB:
|
||||
case BPF_AND:
|
||||
case BPF_XOR:
|
||||
case BPF_OR:
|
||||
return true;
|
||||
|
||||
/* Compute range for the following only if the src_reg is const.
|
||||
*/
|
||||
case BPF_XOR:
|
||||
case BPF_OR:
|
||||
case BPF_MUL:
|
||||
return src_is_const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue