From: Paolo Pisati paolo.pisati@canonical.com
After applying patch 0001, all checksum implementations i could test (x86-64, arm64 and arm), now agree on the return value.
Patch 0002 fix the expected return value for test #13: i did the calculation manually, and it correspond.
Unfortunately, after applying patch 0001, other test cases now fail in test_verifier:
$ sudo ./tools/testing/selftests/bpf/test_verifier ... #417/p helper access to variable memory: size = 0 allowed on NULL (ARG_PTR_TO_MEM_OR_NULL) FAIL retval 65535 != 0 #419/p helper access to variable memory: size = 0 allowed on != NULL stack pointer (ARG_PTR_TO_MEM_OR_NULL) FAIL retval 65535 != 0 #423/p helper access to variable memory: size possible = 0 allowed on != NULL packet pointer (ARG_PTR_TO_MEM_OR_NULL) FAIL retval 65535 != 0 ... Summary: 1500 PASSED, 0 SKIPPED, 3 FAILED
And there are probably other fallouts in other selftests - someone familiar should take a look before applying these patches.
Paolo Pisati (2): bpf: bpf_csum_diff: fold the checksum before returning the value bpf, selftest: fix checksum value for test #13
net/core/filter.c | 2 +- tools/testing/selftests/bpf/verifier/array_access.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
From: Paolo Pisati paolo.pisati@canonical.com
With this change, bpf_csum_diff behave homogeneously among different checksum calculation code / csum_partial() (tested on x86-64, arm64 and arm).
Signed-off-by: Paolo Pisati paolo.pisati@canonical.com --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c index f615e42cf4ef..8db7f58f1ea1 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -1990,7 +1990,7 @@ BPF_CALL_5(bpf_csum_diff, __be32 *, from, u32, from_size, for (i = 0; i < to_size / sizeof(__be32); i++, j++) sp->diff[j] = to[i];
- return csum_partial(sp->diff, diff_size, seed); + return csum_fold(csum_partial(sp->diff, diff_size, seed)); }
static const struct bpf_func_proto bpf_csum_diff_proto = {
From: Paolo Pisati paolo.pisati@canonical.com
Signed-off-by: Paolo Pisati paolo.pisati@canonical.com --- tools/testing/selftests/bpf/verifier/array_access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/verifier/array_access.c b/tools/testing/selftests/bpf/verifier/array_access.c index bcb83196e459..4698f560d756 100644 --- a/tools/testing/selftests/bpf/verifier/array_access.c +++ b/tools/testing/selftests/bpf/verifier/array_access.c @@ -255,7 +255,7 @@ .prog_type = BPF_PROG_TYPE_SCHED_CLS, .fixup_map_array_ro = { 3 }, .result = ACCEPT, - .retval = -29, + .retval = 28, }, { "invalid write map access into a read-only array 1",
On Thu, Jul 11, 2019 at 2:41 AM Paolo Pisati p.pisati@gmail.com wrote:
From: Paolo Pisati paolo.pisati@canonical.com
Please include description, in addition to subject.
Also, when submitting patches, please add bpf or bpf-next (e.g., [PATCH bpf 2/2] to indicate which tree it's supposed to go into). For this one it's probably bpf.
Signed-off-by: Paolo Pisati paolo.pisati@canonical.com
tools/testing/selftests/bpf/verifier/array_access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/verifier/array_access.c b/tools/testing/selftests/bpf/verifier/array_access.c index bcb83196e459..4698f560d756 100644 --- a/tools/testing/selftests/bpf/verifier/array_access.c +++ b/tools/testing/selftests/bpf/verifier/array_access.c @@ -255,7 +255,7 @@ .prog_type = BPF_PROG_TYPE_SCHED_CLS, .fixup_map_array_ro = { 3 }, .result = ACCEPT,
.retval = -29,
.retval = 28,
}, { "invalid write map access into a read-only array 1", -- 2.17.1
linux-kselftest-mirror@lists.linaro.org