[PATCH bpf-next v2] selftests/bpf: Add alignment flag for test_verifier 190 testcase

Tiezhu Yang posted 1 patch 2 weeks, 6 days ago
tools/testing/selftests/bpf/verifier/calls.c | 1 +
1 file changed, 1 insertion(+)
[PATCH bpf-next v2] selftests/bpf: Add alignment flag for test_verifier 190 testcase
Posted by Tiezhu Yang 2 weeks, 6 days ago
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set unconditionally for the
most archs such as x86_64, aarch64, ppc64el and s390x, but this config
may be not set by users for riscv64 and loongarch64.

There exists failure about misaligned access when executing the testcase
"./test_verifier 190" when CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not
set on LoongArch due to CONFIG_ARCH_STRICT_ALIGN is set by default.

It means that the program has unaligned accesses, but the kernel enables
the compiler option -mstrict-align to prevent unaligned accesses, so add
a flag F_NEEDS_EFFICIENT_UNALIGNED_ACCESS into the testcase to avoid the
failure.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Acked-by: Paul Chaignon <paul.chaignon@gmail.com>
---

v2: Update the commit message and collect R-b and A-b,
    thanks Emil and Paul.

 tools/testing/selftests/bpf/verifier/calls.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/verifier/calls.c b/tools/testing/selftests/bpf/verifier/calls.c
index 86887130a0ef..29e57f0e56c3 100644
--- a/tools/testing/selftests/bpf/verifier/calls.c
+++ b/tools/testing/selftests/bpf/verifier/calls.c
@@ -1521,6 +1521,7 @@
 	.errstr = "R0 invalid mem access 'scalar'",
 	.result_unpriv = REJECT,
 	.errstr_unpriv = "invalid read from stack R7 off=-16 size=8",
+	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
 },
 {
 	"calls: two calls that receive map_value via arg=ptr_stack_of_caller. test1",
-- 
2.42.0