Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1286659imm; Fri, 1 Jun 2018 20:30:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIcvnR76LiSe1NxlTGfeQwu2qawr7De5vPkm/cPhSG3xfaNyi3XbdHBijKK8uX0+gTe/ZB3 X-Received: by 2002:a62:9b57:: with SMTP id r84-v6mr13350913pfd.157.1527910241057; Fri, 01 Jun 2018 20:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527910241; cv=none; d=google.com; s=arc-20160816; b=A7WmzG1RdShTxODvNcvNAtNbPMaPhTtIaBcleEzOhr3XPZuk8i58+3HCgsjzWqmQqU H8tqRmsBigB96tngCaGZhWl97/5r/BaGQAWsOlf22DKjKSG7Qh3ofqKQdu1+qQu9Nydv VuhYaS1crU0I7g2DHkeOFQiL6c0lMDSxR0a0vcMS/CYPfOYQajJF9peaGw4v/WtThVTi 95CTz+Flb/QjoAQqtyAKwWXpKGdHXrS6DfvWqLnnR0xDOMWqSDn35TtWx9iJGhw+/+Jm Zfr1mJU2ZBDEU7CWwJy9t9zMw03X735sSm2OTYfsCOMg/PG++Z5LzBuYEzMIYNA52M+u knZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Gb4i6KBVGvnw4qjcbWJlYZ9c5Cd9SWNyamziHtg41D8=; b=a4KFqavLIJG5Q838xiD8QYfoewTK243pKdGQaqN4R97REFd9m27ew88udDFs8GwQ+l Yl/NoWPyxV2b3pD5kK8N2KuLZF00nz8OkOKQ8SU10iVSTQGFKDtwqIg952koSr5t0k3W BhWdDAlcRWP11+5CnRXD4ePD/eGNdF6Y9P0eZExbamUTvo5s/AliA0xmeI4vgIwHZ2wE IrI1C6SvGrP9tAAlMU1dSwWV5kHO0/cJnJtt4djPhDAKp6KW8u3T4U7bzyR3F/Fsb3M+ NWqVCgF/Gh13+Kx81aTscotHEA8xZFdJeiAKJk60qNJ0SWrpVWxCBLrz7vDeDK4PX6TT QWwQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g130-v6si40770416pfc.366.2018.06.01.20.30.27; Fri, 01 Jun 2018 20:30:41 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751976AbeFBD3P (ORCPT + 99 others); Fri, 1 Jun 2018 23:29:15 -0400 Received: from www62.your-server.de ([213.133.104.62]:37216 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870AbeFBD2x (ORCPT ); Fri, 1 Jun 2018 23:28:53 -0400 Received: from [50.234.174.228] (helo=localhost.localdomain) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1fOxDm-0000Ev-O1; Sat, 02 Jun 2018 05:28:51 +0200 Subject: Re: [PATCH bpf 1/2] bpf: fix alignment of netns_dev/netns_ino fields in bpf_{map,prog}_info To: Song Liu , Eugene Syromiatnikov Cc: netdev@vger.kernel.org, open list , Martin KaFai Lau , Alexei Starovoitov , "David S. Miller" , Jiri Olsa , Ingo Molnar , Lawrence Brakmo , Andrey Ignatov , Jakub Kicinski , John Fastabend , "Dmitry V. Levin" References: <20180527112842.GA18204@asgard.redhat.com> From: Daniel Borkmann Message-ID: Date: Sat, 2 Jun 2018 05:28:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 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.99.3/24624/Fri Jun 1 22:38:16 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/29/2018 07:17 PM, Song Liu wrote: > On Sun, May 27, 2018 at 4:28 AM, Eugene Syromiatnikov wrote: >> 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))); > > Shall we add a __u32 padding variable before netns_dev? We can use it > for in the future. Agree with Song, and definitely prefer that approach since we already use the hole as a bitfield in net-next; like this https://patchwork.ozlabs.org/patch/924415/.