]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Simplify reg_set_min_max_inv handling
authorJann Horn <jannh@google.com>
Mon, 30 Mar 2020 16:03:24 +0000 (18:03 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 30 Mar 2020 18:53:52 +0000 (11:53 -0700)
commitfded05b62f43f4ef9a131bae475748932a194c5d
tree63fa1cc54f7facfd7258bf235990169d858148b3
parentc5c7009d5acd42ad22c1c6d98a7ca02e373cebe8
bpf: Simplify reg_set_min_max_inv handling

reg_set_min_max_inv() contains exactly the same logic as reg_set_min_max(),
just flipped around. While this makes sense in a cBPF verifier (where ALU
operations are not symmetric), it does not make sense for eBPF.

Replace reg_set_min_max_inv() with a helper that flips the opcode around,
then lets reg_set_min_max() do the complicated work.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200330160324.15259-4-daniel@iogearbox.net
kernel/bpf/verifier.c