Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp340145imm; Fri, 1 Jun 2018 01:42:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLj8x4cu3MNnTv6Dj6YRLkh33fFJizhBdlrNZx9VdpN/KrjfYgkWkY2LSTVZTz9en4mufQ3 X-Received: by 2002:a17:902:9344:: with SMTP id g4-v6mr10444106plp.10.1527842572131; Fri, 01 Jun 2018 01:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527842572; cv=none; d=google.com; s=arc-20160816; b=kGebxvhpEBWfYP4AKJzYncp0XXQL7cq7oIGokYVZiprEGjGCXFX02Ai4OFzeyYl74X qLakTfzUcDV732Vh7f/jaHRQt3lwzpctGhMVf/1xaITZDaiACirvZCn13lDx7spL759F oqotxcT9nEOVjjPq8A6oNM+I3egzjl3CHezGlMB24v4gquUn929g3J7bdKpV8kqT8KZD /MfZ8rKQBEsAuksoUZJTRX92rNvvvQviEyJ6nYKmUSFL7XWeFmd33gDMmQNGyRqTdLAH lxHd4jYO24YNOyLIQtGheCphCKdu8RLo41ErkcYQcPPfw4vkwcaV9fgNKQDJiUVOWeKF 8HtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date:dkim-signature:arc-authentication-results; bh=CTARTOHu8dRJJfVtHXxppJp3KYuIr+732p2R/0KT//g=; b=Chn2ZyZYQSqDEGDPwc7Req9luK3RWUZUPRUyHLncqkc3YnDeOtLP7kqmYLNDthVZCU nwie9sjC8SvsTutcAATpSIj8LVgPkg+RFasmf6HDLerHhO2SpK/S6V25GI/Fg7lew/J7 +a2Rv6/PuhxKNSVkrPwDE0pHS0uRhY55DLeQ3l7iyf1UCwnQ035mY1QI5PsPqZG83yxV eXbEuoc7ERAMdP30FLl97f1AHjoKDmkdsAbXJLYWdaEAdOpspgWy3/VPAlDxjhE4mJ2N UH+sasJ+iRelBoanQyRKCkprNBvLJl9Hslm5Mh3H9iLVnyMydVTEYg7nqO2YwnNouR/b ZDwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U2cWXmo7; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2-v6si17612277pls.575.2018.06.01.01.42.35; Fri, 01 Jun 2018 01:42:52 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U2cWXmo7; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751223AbeFAIl0 (ORCPT + 99 others); Fri, 1 Jun 2018 04:41:26 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:46530 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750724AbeFAIlV (ORCPT ); Fri, 1 Jun 2018 04:41:21 -0400 Received: by mail-pf0-f196.google.com with SMTP id p19-v6so7943834pff.13; Fri, 01 Jun 2018 01:41:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CTARTOHu8dRJJfVtHXxppJp3KYuIr+732p2R/0KT//g=; b=U2cWXmo7wPbCFKK/F/cEPx3IcaKfwkDtqYz5M2GldyyG/NfGz7Lrd+vv2gg/ycQsND NKS+BGVZxAWmbStf8++xN6m4/qm43WyN2w2/vVa3h5yRE9yHvfoSqGxt1WKcpbqosvoX 474nA1L2REfTCKCQoc2KNWI1ILFkv2Sjynp4isaq9dEHvx6ESHkG+goJ/wRJU1zlnsu/ hV0T+d/AChkU5lgeOpIhXF6ZLLuOylxEY9p3Jk4v2AfKA+LZE2nR4oRLQ0mWa9OA2tB4 ZMTDckJ9JNMAfKu3t4asz67v5POnIBctu09GtEi+8Gekvh1JAThkreq0Qdf0SGBqNjTT Ktuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CTARTOHu8dRJJfVtHXxppJp3KYuIr+732p2R/0KT//g=; b=tTHbeUEkoSliIXNt6ZzRvkI59UFu63LnFgaGV2d++1cfLFvWoU2zwrtvFx3DuiZaZl 68y2VGoiFSYMEsK6NHx8QEaYmg7RWssGu4Ve8uPDYIS8lsqgjwgjZKZ89a4+Xes50J04 Q36p+u5zG/DPPAucllTekSa/D8pENbfQQM19TSB6XiF0YY6GxYGDC3V63k9q0ArgMtW9 dDphv61i4+sBgfCy4WKBJxDkFwwGShih2UiWk1snp1QNZ9DyOLro4C9gv2HmSpO6YzB6 DmKdxmNZJFwK0dKZHSo7Y5GVcW0aT3FUwTQALnFuIkKH6O5+laykThMdcRBj8hemR9bv IBFQ== X-Gm-Message-State: ALKqPwdbVXLAZZkTzNg5roOzgZxdqPqKgIF7GtpzJQYC+ZNbSI+SE1Bj SseLvEot9LNjYuDuAE/2OzM= X-Received: by 2002:a62:3a59:: with SMTP id h86-v6mr10027389pfa.209.1527842480932; Fri, 01 Jun 2018 01:41:20 -0700 (PDT) Received: from ast-mbp ([2620:10d:c090:180::1:af11]) by smtp.gmail.com with ESMTPSA id z28-v6sm31094852pfl.169.2018.06.01.01.41.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 01:41:19 -0700 (PDT) Date: Fri, 1 Jun 2018 04:41:16 -0400 From: Alexei Starovoitov To: Linus Torvalds , Eugene Syromiatnikov , netdev@vger.kernel.org, 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 Subject: Re: [PATCH bpf 1/2] bpf: fix alignment of netns_dev/netns_ino fields in bpf_{map,prog}_info Message-ID: <20180601084114.xgvtg7nmihdavnnd@ast-mbp> References: <20180527112842.GA18204@asgard.redhat.com> <20180530181857.GA6744@altlinux.org> <20180601031210.GA30533@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180601031210.GA30533@altlinux.org> User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 01, 2018 at 06:12:10AM +0300, Dmitry V. Levin wrote: > Hi, > > Looks like the ABI bug in bpf_map_info and bpf_prog info introduced > in 4.16 is going to slip into 4.17, causing extra pain to 32-bit > userspace. I'm adding Linus to this thread in hope it might help > to get a fix applied before 4.17 is released. The issue identified in patch 1 is valid. These two fields won't be properly accessible by 32-bit user space on 64-bit kernel. But the fix in patch 1 is wrong. The patch 2 is completely unnecessary. Everyone can also see that the patches are still marked as 'new' in patchworks meaning that we didn't process them. At the moment many networking folks are traveling to netconf and we only had a chance to discuss this set last night. We'll try to send a fix in coming days. But regardless whether 4.17 is realesed this sunday or not we're not going to rush wrong patch in without proper code review and discussion. That future patch either will land in 4.17 (if it's dealyed into next sunday) or it will be sent to stable. To speed up the situation next time please report the issue that you find to public netdev mailing list instead of using proprietary distro emails. Thanks. > On Wed, May 30, 2018 at 09:18:58PM +0300, Dmitry V. Levin wrote: > > On Sun, May 27, 2018 at 01:28:42PM +0200, 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 > > > > Reviewed-by: "Dmitry V. Levin" > > Cc: # v4.16+ > > > > Thanks, > > > > > --- > > > 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 > > > -- > ldv