Commit 67afdc7
bpf: Fix verifier jsgt branch analysis on max bound
commit ee114dd upstream.
Fix incorrect is_branch{32,64}_taken() analysis for the jsgt case. The return
code for both will tell the caller whether a given conditional jump is taken
or not, e.g. 1 means branch will be taken [for the involved registers] and the
goto target will be executed, 0 means branch will not be taken and instead we
fall-through to the next insn, and last but not least a -1 denotes that it is
not known at verification time whether a branch will be taken or not. Now while
the jsgt has the branch-taken case correct with reg->s32_min_value > sval, the
branch-not-taken case is off-by-one when testing for reg->s32_max_value < sval
since the branch will also be taken for reg->s32_max_value == sval. The jgt
branch analysis, for example, gets this right.
Fixes: 3f50f13 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Fixes: 4f7b3e8 ("bpf: improve verifier branch analysis")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 1d16cc2 commit 67afdc7
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6822 | 6822 | | |
6823 | 6823 | | |
6824 | 6824 | | |
6825 | | - | |
| 6825 | + | |
6826 | 6826 | | |
6827 | 6827 | | |
6828 | 6828 | | |
| |||
6895 | 6895 | | |
6896 | 6896 | | |
6897 | 6897 | | |
6898 | | - | |
| 6898 | + | |
6899 | 6899 | | |
6900 | 6900 | | |
6901 | 6901 | | |
| |||
0 commit comments