[1/1] UBUNTU: SAUCE: Fix "bpf: improve verifier branch analysis"
diff mbox series

Message ID 20190829003133.1095-2-tyhicks@canonical.com
State New
Headers show
Series
  • [1/1] UBUNTU: SAUCE: Fix "bpf: improve verifier branch analysis"
Related show

Commit Message

Tyler Hicks Aug. 29, 2019, 12:31 a.m. UTC
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@canonical.com>
---
 tools/testing/selftests/bpf/test_verifier.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Kleber Souza Aug. 29, 2019, 7:51 a.m. UTC | #1
On 29.08.19 02:31, Tyler Hicks wrote:
> 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@canonical.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@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(),
>  		},
>
Stefan Bader Aug. 29, 2019, 7:57 a.m. UTC | #2
On 29.08.19 02:31, Tyler Hicks wrote:
> 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@canonical.com>
Acked-by: Stefan Bader <stefan.bader@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(),
>  		},
>

Patch
diff mbox series

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(),
 		},