[PATCH 1/1] UBUNTU: SAUCE: Fix "bpf: improve verifier branch analysis"

Tyler Hicks tyhicks at canonical.com
Thu Aug 29 00:31:33 UTC 2019


BugLink: https://launchpad.net/bugs/1841704

The upstream linux-stable backport of commit 4f7b3e82589e ("bpf: improve
verifier branch analysis") dropped the changes to the bpf selftests
which caused new test failures.

Fix the new test failures by making the .errstr and BPF_JMP_IMM()
changes from commit 4f7b3e82589e ("bpf: improve verifier branch
analysis").

Also, make the .errstr_unpriv change from commit 80c9b2fae87b ("bpf: add
various test cases to selftests"). That change was previously dropped
from my backport of that commit because we didn't backport commit
4f7b3e82589e at that time.

Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
---
 tools/testing/selftests/bpf/test_verifier.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index 95e9e751862a..3b3ebf1d1f27 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -7013,8 +7013,8 @@ static struct bpf_test tests[] = {
 			BPF_JMP_IMM(BPF_JA, 0, 0, -7),
 		},
 		.fixup_map1 = { 4 },
-		.errstr = "R0 invalid mem access 'inv'",
-		.errstr_unpriv = "R0 invalid mem access 'inv'",
+		.errstr = "unbounded min value",
+		.errstr_unpriv = "R1 has unknown scalar with mixed signed bounds",
 		.result = REJECT,
 	},
 	{
@@ -9031,7 +9031,7 @@ static struct bpf_test tests[] = {
 		"check deducing bounds from const, 5",
 		.insns = {
 			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_EXIT_INSN(),
 		},
-- 
2.17.1




More information about the kernel-team mailing list