From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD5CFC76195 for ; Mon, 15 Jul 2019 22:16:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9388920665 for ; Mon, 15 Jul 2019 22:16:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732958AbfGOWQk (ORCPT ); Mon, 15 Jul 2019 18:16:40 -0400 Received: from www62.your-server.de ([213.133.104.62]:33478 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727862AbfGOWQk (ORCPT ); Mon, 15 Jul 2019 18:16:40 -0400 Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1hn9Gw-0000qf-3w; Tue, 16 Jul 2019 00:16:38 +0200 Received: from [99.0.85.34] (helo=localhost.localdomain) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1hn9Gv-0000rq-Nu; Tue, 16 Jul 2019 00:16:37 +0200 Subject: Re: [PATCH v2 bpf-next] selftests/bpf: fix "alu with different scalars 1" on s390 To: Alexei Starovoitov , Ilya Leoshkevich Cc: bpf , Network Development , Y Song References: <20190704085224.65223-1-iii@linux.ibm.com> From: Daniel Borkmann Message-ID: <43594293-710b-b217-cd04-a8051e3742f7@iogearbox.net> Date: Tue, 16 Jul 2019 00:16:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.3/25511/Mon Jul 15 10:10:35 2019) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 7/16/19 12:13 AM, Alexei Starovoitov wrote: > On Thu, Jul 4, 2019 at 1:53 AM Ilya Leoshkevich 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 >> --- >> >> 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 > > I think tests should be arch and endian independent where possible. > In this case test_val.index is 4 byte and 4 byte load should work just as well. Yes, agree, this should be fixed with BPF_W as load. Thanks, Daniel