提交 b680cd59 编写于 作者: O Ovidiu Panait 提交者: Yang Yingliang

selftests/bpf: add selftest part of "bpf: improve verifier branch analysis"

stable inclusion
from linux-4.19.193
commit c905bfe767e98a13dd886bf241ba9ee0640a53ff

--------------------------------

Backport the missing selftest part of commit 7da6cd690c43 ("bpf: improve
verifier branch analysis") in order to fix the following test_verifier
failures:

...
Unexpected success to load!
0: (b7) r0 = 0
1: (75) if r0 s>= 0x0 goto pc+1
3: (95) exit
processed 3 insns (limit 131072), stack depth 0
Unexpected success to load!
0: (b7) r0 = 0
1: (75) if r0 s>= 0x0 goto pc+1
3: (95) exit
processed 3 insns (limit 131072), stack depth 0
...

The changesets apply with a minor context difference.

Fixes: 7da6cd690c43 ("bpf: improve verifier branch analysis")
Signed-off-by: NOvidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 ff5ead11
...@@ -7867,7 +7867,7 @@ static struct bpf_test tests[] = { ...@@ -7867,7 +7867,7 @@ static struct bpf_test tests[] = {
BPF_JMP_IMM(BPF_JA, 0, 0, -7), BPF_JMP_IMM(BPF_JA, 0, 0, -7),
}, },
.fixup_map1 = { 4 }, .fixup_map1 = { 4 },
.errstr = "R0 invalid mem access 'inv'", .errstr = "unbounded min value",
.errstr_unpriv = "R1 has unknown scalar with mixed signed bounds", .errstr_unpriv = "R1 has unknown scalar with mixed signed bounds",
.result = REJECT, .result = REJECT,
}, },
...@@ -9850,7 +9850,7 @@ static struct bpf_test tests[] = { ...@@ -9850,7 +9850,7 @@ static struct bpf_test tests[] = {
"check deducing bounds from const, 5", "check deducing bounds from const, 5",
.insns = { .insns = {
BPF_MOV64_IMM(BPF_REG_0, 0), BPF_MOV64_IMM(BPF_REG_0, 0),
BPF_JMP_IMM(BPF_JSGE, BPF_REG_0, 0, 1), BPF_JMP_IMM(BPF_JSGE, BPF_REG_0, 1, 1),
BPF_ALU64_REG(BPF_SUB, BPF_REG_0, BPF_REG_1), BPF_ALU64_REG(BPF_SUB, BPF_REG_0, BPF_REG_1),
BPF_EXIT_INSN(), BPF_EXIT_INSN(),
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册