diff mbox series

[bpf-next] selftests/bpf: Fix endianness issues in atomic tests

Message ID 20210210020713.77911-1-iii@linux.ibm.com (mailing list archive)
State Accepted
Commit 45df3052682564327acc0a0fdb0f9adc3a27a50b
Delegated to: BPF
Headers show
Series [bpf-next] selftests/bpf: Fix endianness issues in atomic tests | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 10 maintainers not CCed: jackmanb@google.com shuah@kernel.org yhs@fb.com kafai@fb.com netdev@vger.kernel.org songliubraving@fb.com kpsingh@kernel.org john.fastabend@gmail.com linux-kselftest@vger.kernel.org andrii@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Ilya Leoshkevich Feb. 10, 2021, 2:07 a.m. UTC
Atomic tests store a DW, but then load it back as a W from the same
address. This doesn't work on big-endian systems, and since the point
of those tests is not testing narrow loads, fix simply by loading a
DW.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Fixes: 98d666d05a1d ("bpf: Add tests for new BPF atomic operations")
---
 tools/testing/selftests/bpf/verifier/atomic_and.c | 2 +-
 tools/testing/selftests/bpf/verifier/atomic_or.c  | 2 +-
 tools/testing/selftests/bpf/verifier/atomic_xor.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 10, 2021, 8:20 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Wed, 10 Feb 2021 03:07:13 +0100 you wrote:
> Atomic tests store a DW, but then load it back as a W from the same
> address. This doesn't work on big-endian systems, and since the point
> of those tests is not testing narrow loads, fix simply by loading a
> DW.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> Fixes: 98d666d05a1d ("bpf: Add tests for new BPF atomic operations")
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests/bpf: Fix endianness issues in atomic tests
    https://git.kernel.org/bpf/bpf-next/c/45df30526825

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Andrii Nakryiko Feb. 10, 2021, 8:28 p.m. UTC | #2
On Tue, Feb 9, 2021 at 6:11 PM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> Atomic tests store a DW, but then load it back as a W from the same
> address. This doesn't work on big-endian systems, and since the point
> of those tests is not testing narrow loads, fix simply by loading a
> DW.
>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> Fixes: 98d666d05a1d ("bpf: Add tests for new BPF atomic operations")
> ---

Applied to bpf-next.

>  tools/testing/selftests/bpf/verifier/atomic_and.c | 2 +-
>  tools/testing/selftests/bpf/verifier/atomic_or.c  | 2 +-
>  tools/testing/selftests/bpf/verifier/atomic_xor.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/verifier/atomic_and.c b/tools/testing/selftests/bpf/verifier/atomic_and.c
index 600bc5e0f143..1bdc8e6684f7 100644
--- a/tools/testing/selftests/bpf/verifier/atomic_and.c
+++ b/tools/testing/selftests/bpf/verifier/atomic_and.c
@@ -7,7 +7,7 @@ 
 		BPF_MOV64_IMM(BPF_REG_1, 0x011),
 		BPF_ATOMIC_OP(BPF_DW, BPF_AND, BPF_REG_10, BPF_REG_1, -8),
 		/* if (val != 0x010) exit(2); */
-		BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_10, -8),
+		BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_10, -8),
 		BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0x010, 2),
 		BPF_MOV64_IMM(BPF_REG_0, 2),
 		BPF_EXIT_INSN(),
diff --git a/tools/testing/selftests/bpf/verifier/atomic_or.c b/tools/testing/selftests/bpf/verifier/atomic_or.c
index ebe6e51455ba..70f982e1f9f0 100644
--- a/tools/testing/selftests/bpf/verifier/atomic_or.c
+++ b/tools/testing/selftests/bpf/verifier/atomic_or.c
@@ -7,7 +7,7 @@ 
 		BPF_MOV64_IMM(BPF_REG_1, 0x011),
 		BPF_ATOMIC_OP(BPF_DW, BPF_OR, BPF_REG_10, BPF_REG_1, -8),
 		/* if (val != 0x111) exit(2); */
-		BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_10, -8),
+		BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_10, -8),
 		BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0x111, 2),
 		BPF_MOV64_IMM(BPF_REG_0, 2),
 		BPF_EXIT_INSN(),
diff --git a/tools/testing/selftests/bpf/verifier/atomic_xor.c b/tools/testing/selftests/bpf/verifier/atomic_xor.c
index eb791e547b47..74e8fb46694b 100644
--- a/tools/testing/selftests/bpf/verifier/atomic_xor.c
+++ b/tools/testing/selftests/bpf/verifier/atomic_xor.c
@@ -7,7 +7,7 @@ 
 		BPF_MOV64_IMM(BPF_REG_1, 0x011),
 		BPF_ATOMIC_OP(BPF_DW, BPF_XOR, BPF_REG_10, BPF_REG_1, -8),
 		/* if (val != 0x101) exit(2); */
-		BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_10, -8),
+		BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_10, -8),
 		BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0x101, 2),
 		BPF_MOV64_IMM(BPF_REG_0, 2),
 		BPF_EXIT_INSN(),