Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp12079557ybi; Fri, 26 Jul 2019 04:27:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyK3//GIMQYeOAqskheZ7Bwumv8Vr5ThyZuwuSJRgO9mQAMBSxZwRKe7qx8F/0aimGMfdci X-Received: by 2002:a17:902:29e6:: with SMTP id h93mr38074863plb.297.1564140477650; Fri, 26 Jul 2019 04:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564140477; cv=none; d=google.com; s=arc-20160816; b=VqPGomO1Y79cgEag1BJnRgjiw+yZpXS14Qx+f2koBc1dVkWBQgoNPsye3CSXhppduE +mEC6yvWSuJC1XE3Vo/C1f0XgnCYeyshoMsBolTlxow1drQK5JEu8xEjW3eaYv4/3Fma DukDUvEfxLWQUzU6HTrSzVyfSNGSpULXJjgBcocOHFJz5MxBaVyqTisKWyK5vdEUvOiG THcL0JenSPkxA3hlYgnkloAG+hAQCR9WBsZudGAb3a4+OpJgakrIiZd8enwAsqXJYyxH MnOK/19/DDWb1nELZjYqZVFu8FSwYH6pPa5FwkDWpKOMBdA3kiBZI1LUU3yz1CUlAQG4 TLlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=mxtQTyz1jr4asSEEq6Sox9bcILV4txWbsV0XEV0OPp8=; b=wxuduC7dBEOlm56MyIViKBaiixexeqeeu+g1+98Ft1mcU5o01YkfwBQ1IVIA3b3fGJ /Jh4Jt+C4Q13511MoVIfLJp0+/wWBFAhtddwwL3bcjjNZtKJpQ6LB0p53U5l3O8P3O4K OVD6lxs1EpgonNQsoYL+FvPsgWyml0do+4lQiLAXST1Th91QLMmrK9mlbHFuDa843Pwl 7qsoYxXKpZBPzeW2g/nPUZN5V1Vz88wXV1/FH4gO0LnNl1/OYCEUHKatypqPxonqCQf2 Hg9RrYDHzJNI0gZb30KjFnkxYnwFQFF8dxG9DM6KjQC6aPTfUXLz9J2pX5R3s5FACfND x3tQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o93si19728472pje.38.2019.07.26.04.27.42; Fri, 26 Jul 2019 04:27:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726636AbfGZKl6 (ORCPT + 99 others); Fri, 26 Jul 2019 06:41:58 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:41570 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbfGZKl6 (ORCPT ); Fri, 26 Jul 2019 06:41:58 -0400 Received: by mail-ot1-f65.google.com with SMTP id o101so54866743ota.8 for ; Fri, 26 Jul 2019 03:41:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mxtQTyz1jr4asSEEq6Sox9bcILV4txWbsV0XEV0OPp8=; b=PekS4KR0X9vn0yTHgOLNKd0Pehxn9bLXQ0I1jUk+92Rd7mFWzB8NTki85n2UyH67gx C5lBeNAPS0cAZv7ms8oG9OibPi5F5dcww9tMvqmD7FDHCyVK/LmCkDHKFJsKwvnuTPXt H/sYlVMdA4GaIgKE4YmsY4l0tDUtxeWkW5JCXQrL278fVwssRycr3MU87isArd3oLaqj x2z0w4o/I4lDXntH9fV7fGZQu/bZT64HzyZWiwVX7NQJMt6QDiE1V2VQhSCpzTFxxbDB PcNsT2YJ2aJy+qXvOUTtbAkdGun5U6EuTEfpvr7WmGsItrf7VojQNLdfuiyEGSpNRSFi MU5Q== X-Gm-Message-State: APjAAAXKaKbVVidK74/06qkfAEl11O6kvzlljCS2JieKrGVVnaUl2gHd ljvrzGYxRZiA5NoBQTyLyek4DeR9Q94sG7kL4H4XlA== X-Received: by 2002:a9d:758b:: with SMTP id s11mr30138097otk.130.1564137717287; Fri, 26 Jul 2019 03:41:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yauheni Kaliuta Date: Fri, 26 Jul 2019 13:41:41 +0300 Message-ID: Subject: Re: bpf: test_verifier: sanitation: alu with different scalars To: Daniel Borkmann Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Jiri Benc Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Daniel, On Tue, Jun 25, 2019 at 12:39 PM Daniel Borkmann wrote: > > On 06/25/2019 10:29 AM, Yauheni Kaliuta wrote: > > Hi! > > > > I'm wondering, how the sanitaion tests (#903 5.2-rc6 for example) > > are supposed to work on BE arches: > > > > { > > "sanitation: alu with different scalars 1", > > .insns = { > > BPF_MOV64_IMM(BPF_REG_0, 1), > > BPF_LD_MAP_FD(BPF_REG_ARG1, 0), > > BPF_MOV64_REG(BPF_REG_ARG2, BPF_REG_FP), > > BPF_ALU64_IMM(BPF_ADD, BPF_REG_ARG2, -16), > > BPF_ST_MEM(BPF_DW, BPF_REG_FP, -16, 0), > > BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), > > BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), > > BPF_EXIT_INSN(), > > BPF_LDX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0), > > > > reads one byte 0 on BE and 28 on LE (from ->index) since > > > > struct test_val { > > unsigned int index; > > int foo[MAX_ENTRIES]; > > }; > > > > struct test_val value = { > > .index = (6 + 1) * sizeof(int), > > .foo[6] = 0xabcdef12, > > }; > > > > BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 3), > > > > So different branches are taken depending of the endianness. > > > > BPF_MOV64_IMM(BPF_REG_2, 0), > > BPF_MOV64_IMM(BPF_REG_3, 0x100000), > > BPF_JMP_A(2), > > BPF_MOV64_IMM(BPF_REG_2, 42), > > BPF_MOV64_IMM(BPF_REG_3, 0x100001), > > BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_3), > > BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), > > BPF_EXIT_INSN(), > > }, > > .fixup_map_array_48b = { 1 }, > > .result = ACCEPT, > > .retval = 0x100000, > > }, > > Let me get my hands on a s390x box later today and get back to you. Any progress with that? -- WBR, Yauheni