Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1335089imm; Sun, 27 May 2018 04:28:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpwdCsK+KM2kYUdfar/au5VaYLvjbej1qpehOIm0sJqicpPaagI1PNuRPO4f7NX2sw4Ljtp X-Received: by 2002:a62:5754:: with SMTP id l81-v6mr9537665pfb.56.1527420528846; Sun, 27 May 2018 04:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527420528; cv=none; d=google.com; s=arc-20160816; b=Armg9RzgmvE7JOCkV9vYy8gtlh9Ru3DMQbZ17rmKwsqzlx5oTqUcQHc6w9Kztw95JK TFMQccxj/LkZMlXJrsAEY8ZWksjcSERxVpw+h6NgJE+3PAKl0kw1zdvvuuNHGw23TdUv wqX//m6XlhGUtyCJj2aZlzkmw00xsdnn3nujn2kwbpm49ozc92vdHc7hkC2cYqs5MvNZ RERZ+7iS99CqUXhIOg6hibzlj6kZX9J3OdsuPMM5K6fErF/gXS+qI2XXZRCZIBWPeYZ1 +hBi79GK0fKQy/zBP+gnBeDJ90979ptNujQLl57eaFv6FD6ozoT3BNPuQVdVH9PNAEAg gf3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=WDh0V/KRukHfIPsElM5EJtDoHFkcIQ/BQqRnqQscpQw=; b=iBXRzz4H4CcGgWa3PRYw/v0VEWfNh/N8He3k0L/Amx2KtSBLzu26i/gOp1IQZJzs2n RU+/UEIYLOPJsqwKHjjAfngBfE7I2CQ1Mnlq11iPqVvrwuDgpHcNLyOvAbG5fF3/DtI3 2I2a1rVGzRoiGd+Ejlbe5mpwcOb8L6Zo0WYput9KKOx0sF9eXOZoZQTglGrstGL4loW3 Z1dfqgcgtFWb0dFFXGLF1ikmbQP7St5WfXn/cRqBWAAt9SqS2aB1f04EuAOmrqL+i26D I71wSeGrBy2b7RvI6SWnh1AB4EeNZ5iH8ypkQjwA/o9eoxeo24n4ovcfdCKZJFVI/krq agAQ== 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 v7-v6si9138384plz.86.2018.05.27.04.28.34; Sun, 27 May 2018 04:28:48 -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 S1755315AbeE0L1z (ORCPT + 99 others); Sun, 27 May 2018 07:27:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34588 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755142AbeE0L1w (ORCPT ); Sun, 27 May 2018 07:27:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B9F34022909; Sun, 27 May 2018 11:27:51 +0000 (UTC) Received: from asgard.redhat.com (ovpn-200-16.brq.redhat.com [10.40.200.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 315F16B40D; Sun, 27 May 2018 11:27:47 +0000 (UTC) Date: Sun, 27 May 2018 13:28:42 +0200 From: Eugene Syromiatnikov To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Martin KaFai Lau , Daniel Borkmann , Alexei Starovoitov , "David S. Miller" , Jiri Olsa , Ingo Molnar , Lawrence Brakmo , Andrey Ignatov , Jakub Kicinski , John Fastabend , "Dmitry V. Levin" Subject: [PATCH bpf 1/2] bpf: fix alignment of netns_dev/netns_ino fields in bpf_{map,prog}_info Message-ID: <20180527112842.GA18204@asgard.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sun, 27 May 2018 11:27:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sun, 27 May 2018 11:27:51 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'esyr@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Recent introduction of netns_dev/netns_ino to bpf_map_info/bpf_prog info has broken compat, as offsets of these fields are different in 32-bit and 64-bit ABIs. One fix (other than implementing compat support in syscall in order to handle this discrepancy) is to use __aligned_u64 instead of __u64 for these fields. Reported-by: Dmitry V. Levin Fixes: 52775b33bb507 ("bpf: offload: report device information about offloaded maps") Fixes: 675fc275a3a2d ("bpf: offload: report device information for offloaded programs") Signed-off-by: Eugene Syromiatnikov --- include/uapi/linux/bpf.h | 8 ++++---- tools/include/uapi/linux/bpf.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index c5ec897..903010a 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1017,8 +1017,8 @@ struct bpf_prog_info { __aligned_u64 map_ids; char name[BPF_OBJ_NAME_LEN]; __u32 ifindex; - __u64 netns_dev; - __u64 netns_ino; + __aligned_u64 netns_dev; + __aligned_u64 netns_ino; } __attribute__((aligned(8))); struct bpf_map_info { @@ -1030,8 +1030,8 @@ struct bpf_map_info { __u32 map_flags; char name[BPF_OBJ_NAME_LEN]; __u32 ifindex; - __u64 netns_dev; - __u64 netns_ino; + __aligned_u64 netns_dev; + __aligned_u64 netns_ino; } __attribute__((aligned(8))); /* User bpf_sock_addr struct to access socket fields and sockaddr struct passed diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index c5ec897..903010a 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -1017,8 +1017,8 @@ struct bpf_prog_info { __aligned_u64 map_ids; char name[BPF_OBJ_NAME_LEN]; __u32 ifindex; - __u64 netns_dev; - __u64 netns_ino; + __aligned_u64 netns_dev; + __aligned_u64 netns_ino; } __attribute__((aligned(8))); struct bpf_map_info { @@ -1030,8 +1030,8 @@ struct bpf_map_info { __u32 map_flags; char name[BPF_OBJ_NAME_LEN]; __u32 ifindex; - __u64 netns_dev; - __u64 netns_ino; + __aligned_u64 netns_dev; + __aligned_u64 netns_ino; } __attribute__((aligned(8))); /* User bpf_sock_addr struct to access socket fields and sockaddr struct passed -- 2.1.4