[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH3MdRUWzvSFx2+1Qsd0hty8=Tb71t9nCg872a5-dtvh8DKDLA@mail.gmail.com>
Date: Thu, 4 Jul 2019 10:28:57 -0700
From: Y Song <ys114321@...il.com>
To: Ilya Leoshkevich <iii@...ux.ibm.com>
Cc: bpf <bpf@...r.kernel.org>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 bpf-next] selftests/bpf: fix "alu with different
scalars 1" on s390
On Thu, Jul 4, 2019 at 1:52 AM Ilya Leoshkevich <iii@...ux.ibm.com> wrote:
>
> BPF_LDX_MEM is used to load the least significant byte of the retrieved
> test_val.index, however, on big-endian machines it ends up retrieving
> the most significant byte.
>
> Use the correct least significant byte offset on big-endian machines.
>
> Signed-off-by: Ilya Leoshkevich <iii@...ux.ibm.com>
Acked-by: Yonghong Song <yhs@...com>
> ---
>
> v1->v2:
> - use __BYTE_ORDER instead of __BYTE_ORDER__.
>
> tools/testing/selftests/bpf/verifier/value_ptr_arith.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
> index c3de1a2c9dc5..e5940c4e8b8f 100644
> --- a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
> +++ b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
> @@ -183,7 +183,11 @@
> BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
> BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1),
> BPF_EXIT_INSN(),
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> BPF_LDX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
> +#else
> + BPF_LDX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, sizeof(int) - 1),
> +#endif
> BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 3),
> BPF_MOV64_IMM(BPF_REG_2, 0),
> BPF_MOV64_IMM(BPF_REG_3, 0x100000),
> --
> 2.21.0
>
Powered by blists - more mailing lists