[PATCH 5.4 0/1] bpf: selftests: fix verifier selftests

STALE1825d

Revision v1 of 2 in this series.

4 messages, 2 authors, 2021-08-10 · open the first message on its own page

[PATCH 5.4 0/1] bpf: selftests: fix verifier selftests

From: Ovidiu Panait <hidden>
Date: 2021-08-04 17:20:18

This patchseries fixes all failing bpf verifier selftests:

root@intel-x86-64:~# ./test_verifier
...
#1054/p XDP pkt read, pkt_meta' <= pkt_data, bad access 1 OK
#1055/p XDP pkt read, pkt_meta' <= pkt_data, bad access 2 OK
#1056/p XDP pkt read, pkt_data <= pkt_meta', good access OK
#1057/p XDP pkt read, pkt_data <= pkt_meta', bad access 1 OK
#1058/p XDP pkt read, pkt_data <= pkt_meta', bad access 2 OK
Summary: 1566 PASSED, 0 SKIPPED, 0 FAILED

Daniel Borkmann (1):
  bpf, selftests: Adjust few selftest result_unpriv outcomes

 tools/testing/selftests/bpf/verifier/stack_ptr.c       | 2 --
 tools/testing/selftests/bpf/verifier/value_ptr_arith.c | 8 --------
 2 files changed, 10 deletions(-)

-- 
2.25.1

[PATCH 5.4 1/1] bpf, selftests: Adjust few selftest result_unpriv outcomes

From: Ovidiu Panait <hidden>
Date: 2021-08-04 17:20:18

From: Daniel Borkmann <daniel@iogearbox.net>

Given we don't need to simulate the speculative domain for registers with
immediates anymore since the verifier uses direct imm-based rewrites instead
of having to mask, we can also lift a few cases that were previously rejected.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
[OP: backport to 5.4, small context adjustment in stack_ptr.c]
Signed-off-by: Ovidiu Panait <redacted>
---
 tools/testing/selftests/bpf/verifier/stack_ptr.c       | 2 --
 tools/testing/selftests/bpf/verifier/value_ptr_arith.c | 8 --------
 2 files changed, 10 deletions(-)
diff --git a/tools/testing/selftests/bpf/verifier/stack_ptr.c b/tools/testing/selftests/bpf/verifier/stack_ptr.c
index 7276620ef242..53d2a5a5ec58 100644
--- a/tools/testing/selftests/bpf/verifier/stack_ptr.c
+++ b/tools/testing/selftests/bpf/verifier/stack_ptr.c
@@ -291,8 +291,6 @@
 	BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
 	BPF_EXIT_INSN(),
 	},
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "invalid stack off=0 size=1",
 	.result = ACCEPT,
 	.retval = 42,
 },
diff --git a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
index 28d44e6aa0b7..f9c91b95080e 100644
--- a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
+++ b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
@@ -300,8 +300,6 @@
 	},
 	.fixup_map_array_48b = { 3 },
 	.result = ACCEPT,
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "R0 pointer arithmetic of map value goes out of range",
 	.retval = 1,
 },
 {
@@ -371,8 +369,6 @@
 	},
 	.fixup_map_array_48b = { 3 },
 	.result = ACCEPT,
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "R0 pointer arithmetic of map value goes out of range",
 	.retval = 1,
 },
 {
@@ -472,8 +468,6 @@
 	},
 	.fixup_map_array_48b = { 3 },
 	.result = ACCEPT,
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "R0 pointer arithmetic of map value goes out of range",
 	.retval = 1,
 },
 {
@@ -766,8 +760,6 @@
 	},
 	.fixup_map_array_48b = { 3 },
 	.result = ACCEPT,
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "R0 pointer arithmetic of map value goes out of range",
 	.retval = 1,
 },
 {
-- 
2.25.1

Re: [PATCH 5.4 1/1] bpf, selftests: Adjust few selftest result_unpriv outcomes

From: Ovidiu Panait <hidden>
Date: 2021-08-10 08:52:54

On 04.08.2021 20:20, Ovidiu Panait wrote:
From: Daniel Borkmann <daniel@iogearbox.net>

Given we don't need to simulate the speculative domain for registers with
immediates anymore since the verifier uses direct imm-based rewrites instead
of having to mask, we can also lift a few cases that were previously rejected.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
[OP: backport to 5.4, small context adjustment in stack_ptr.c]
Signed-off-by: Ovidiu Panait <redacted>
Hi Greg,


It seems that this patch was missed for the previous 5.4 release, could 
it be included in the upcoming release?


Thanks!

Ovidiu
quoted hunk
---
  tools/testing/selftests/bpf/verifier/stack_ptr.c       | 2 --
  tools/testing/selftests/bpf/verifier/value_ptr_arith.c | 8 --------
  2 files changed, 10 deletions(-)
diff --git a/tools/testing/selftests/bpf/verifier/stack_ptr.c b/tools/testing/selftests/bpf/verifier/stack_ptr.c
index 7276620ef242..53d2a5a5ec58 100644
--- a/tools/testing/selftests/bpf/verifier/stack_ptr.c
+++ b/tools/testing/selftests/bpf/verifier/stack_ptr.c
@@ -291,8 +291,6 @@
  	BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
  	BPF_EXIT_INSN(),
  	},
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "invalid stack off=0 size=1",
  	.result = ACCEPT,
  	.retval = 42,
  },
diff --git a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
index 28d44e6aa0b7..f9c91b95080e 100644
--- a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
+++ b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
@@ -300,8 +300,6 @@
  	},
  	.fixup_map_array_48b = { 3 },
  	.result = ACCEPT,
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "R0 pointer arithmetic of map value goes out of range",
  	.retval = 1,
  },
  {
@@ -371,8 +369,6 @@
  	},
  	.fixup_map_array_48b = { 3 },
  	.result = ACCEPT,
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "R0 pointer arithmetic of map value goes out of range",
  	.retval = 1,
  },
  {
@@ -472,8 +468,6 @@
  	},
  	.fixup_map_array_48b = { 3 },
  	.result = ACCEPT,
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "R0 pointer arithmetic of map value goes out of range",
  	.retval = 1,
  },
  {
@@ -766,8 +760,6 @@
  	},
  	.fixup_map_array_48b = { 3 },
  	.result = ACCEPT,
-	.result_unpriv = REJECT,
-	.errstr_unpriv = "R0 pointer arithmetic of map value goes out of range",
  	.retval = 1,
  },
  {

Re: [PATCH 5.4 1/1] bpf, selftests: Adjust few selftest result_unpriv outcomes

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2021-08-10 09:41:22

On Tue, Aug 10, 2021 at 11:53:06AM +0300, Ovidiu Panait wrote:
On 04.08.2021 20:20, Ovidiu Panait wrote:
quoted
From: Daniel Borkmann <daniel@iogearbox.net>

Given we don't need to simulate the speculative domain for registers with
immediates anymore since the verifier uses direct imm-based rewrites instead
of having to mask, we can also lift a few cases that were previously rejected.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
[OP: backport to 5.4, small context adjustment in stack_ptr.c]
Signed-off-by: Ovidiu Panait <redacted>
Hi Greg,


It seems that this patch was missed for the previous 5.4 release, could it
be included in the upcoming release?
Ick, sorry about that, I missed it, my fault.

I'll go queue it up now, thanks.

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help