diff options
| author | Yonghong Song <[email protected]> | 2023-04-06 16:45:05 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2023-04-06 22:26:08 +0000 |
| commit | 953d9f5beaf75e88c69a13d70ce424cd606a29f5 (patch) | |
| tree | 2c3b22c17cf94f504e60fc5659a5066a34c58d12 /tools/bpf/bpftool/prog.c | |
| parent | selftests/bpf: Add tests for non-constant cond_op NE/EQ bound deduction (diff) | |
| download | kernel-953d9f5beaf75e88c69a13d70ce424cd606a29f5.tar.gz kernel-953d9f5beaf75e88c69a13d70ce424cd606a29f5.zip | |
bpf: Improve handling of pattern '<const> <cond_op> <non_const>' in verifier
Currently, the verifier does not handle '<const> <cond_op> <non_const>' well.
For example,
...
10: (79) r1 = *(u64 *)(r10 -16) ; R1_w=scalar() R10=fp0
11: (b7) r2 = 0 ; R2_w=0
12: (2d) if r2 > r1 goto pc+2
13: (b7) r0 = 0
14: (95) exit
15: (65) if r1 s> 0x1 goto pc+3
16: (0f) r0 += r1
...
At insn 12, verifier decides both true and false branch are possible, but
actually only false branch is possible.
Currently, the verifier already supports patterns '<non_const> <cond_op> <const>.
Add support for patterns '<const> <cond_op> <non_const>' in a similar way.
Also fix selftest 'verifier_bounds_mix_sign_unsign/bounds checks mixing signed and unsigned, variant 10'
due to this change.
Signed-off-by: Yonghong Song <[email protected]>
Acked-by: Dave Marchevsky <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
0 files changed, 0 insertions, 0 deletions
