Received: by 10.223.176.5 with SMTP id f5csp1962762wra; Sun, 28 Jan 2018 10:39:46 -0800 (PST) X-Google-Smtp-Source: AH8x225n/0Y8gMu7H/WLVLRQKATOkiqLKqJF/ksL4a5KNsEhTCwmv/OZts28hh+mbC7PWXe23Ax9 X-Received: by 2002:a17:902:ab93:: with SMTP id f19-v6mr19984145plr.10.1517164786341; Sun, 28 Jan 2018 10:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517164786; cv=none; d=google.com; s=arc-20160816; b=EQYXNybvA3wE8y4Vy7fw7nkcUlDfgFO5G7qEvGuGc1GXuXklLhhh9T2k/c18RnJkQB 5mOBi2mlDWIHnEA0aL5RZOCDTHgcov7ygsYXLaZ5KuRxz2HUTIgf+OMEnSRMsWqtjz3N c6m8gFHeR4+by/LAhMqkJ1qaeJCjfRJYR4GNzgd08J4dTksIgG0jAvS6pCrJKhCjJho5 eYRi4ecEydtb3gDuXTUlB6t1ZYi5pDXZqJvMSjOA+KdrBkMKmQE4aKudwPeiKxZk+LyC 6J4m7U/4Bc0YNJYQolH4B7y+MhsRbeyA+CJ/w5cBkB3VSVVioh9DqtUKEJQnPStPApiF XdGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=aXGAV7IwvioWMnXVFcZskK8yrW3sAVY/hFKD4clQ6iQ=; b=CgHKzaRU7UDfS4jWe/NVB/QY0Xc3PVzS5x2wN9ML8VN78E4bx5mkY8ItrB4+u8l586 fNDiuv1itXQbDUPX7EdPs7GlyxsTk9aOkTyqzfqQxott5OgFyB/O2Ag3Z6eiCO9d2EXm xR/Lv4S43s2fnU8UKDOijGR5ZGYNsXzuR7L96BCF8UTzhJoRgY0lb9kKWFSdz5TyLgxo Cdziqol1G9r5BpIP/lQXF+a2YxJyxZVnjDcKe7P6hMmGQ+nXCZDZEJ+5kc9c3bb8xfVC Y2Xiqz4Ncg5VCd+LisfkATXzwvNzixvnhJVKvNZJesifT3gXJefF99hI8EBbPke662fI ipjA== 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 61-v6si7495036plb.203.2018.01.28.10.39.31; Sun, 28 Jan 2018 10:39:46 -0800 (PST) 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 S1752164AbeA1Shy (ORCPT + 99 others); Sun, 28 Jan 2018 13:37:54 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:40114 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751955AbeA1Shx (ORCPT ); Sun, 28 Jan 2018 13:37:53 -0500 Received: from p4fea5f09.dip0.t-ipconnect.de ([79.234.95.9] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1efrm3-0007qR-SA; Sun, 28 Jan 2018 19:33:52 +0100 Date: Sun, 28 Jan 2018 19:36:38 +0100 (CET) From: Thomas Gleixner To: Dan Williams cc: Ingo Molnar , linux-arch , Cyril Novikov , Kernel Hardening , Peter Zijlstra , Catalin Marinas , X86 ML , Will Deacon , Russell King , Ingo Molnar , Greg KH , "H. Peter Anvin" , Linus Torvalds , Alan Cox , Linux Kernel Mailing List Subject: Re: [PATCH v5 02/12] array_idx: sanitize speculative array de-references In-Reply-To: Message-ID: References: <151703971300.26578.1185595719337719486.stgit@dwillia2-desk3.amr.corp.intel.com> <151703972396.26578.7326612698912543866.stgit@dwillia2-desk3.amr.corp.intel.com> <20180128085500.djlm5rlbhjlpfj4i@gmail.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 28 Jan 2018, Dan Williams wrote: > On Sun, Jan 28, 2018 at 12:55 AM, Ingo Molnar wrote: > >> + */ > >> +#define array_idx(idx, sz) \ > >> +({ \ > >> + typeof(idx) _i = (idx); \ > >> + typeof(sz) _s = (sz); \ > >> + unsigned long _mask = array_idx_mask(_i, _s); \ > >> + \ > >> + BUILD_BUG_ON(sizeof(_i) > sizeof(long)); \ > >> + BUILD_BUG_ON(sizeof(_s) > sizeof(long)); \ > >> + \ > >> + _i &= _mask; \ > >> + _i; \ > >> +}) > >> +#endif /* __NOSPEC_H__ */ > > > > For heaven's sake, please name a size variable as 'size', not 'sz'. We don't have > > a shortage of characters and can deobfuscate common primitives, can we? > > > > Also, beyond the nits, I also hate the namespace here. We have a new generic > > header providing two new methods: > > > > #include > > > > array_idx_mask() > > array_idx() > > > > which is then optimized for x86 in asm/barrier.h. That's already a non-sequitor. > > > > Then we introduce uaccess API variants with a _nospec() postfix. > > > > Then we add ifence() to x86. > > > > There's no naming coherency to this. > > Ingo, I love you, but please take the incredulity down a bit, > especially when I had 'nospec' in all the names in v1. Thomas, Peter, > and Alexei wanted s/nospec_barrier/ifence/ and Sorry, I never was involved in that discussion. > s/array_idx_nospec/array_idx/. You can always follow on with a patch > to fix up the names and placements to your liking. While they'll pick > on my name choices, they won't pick on yours, because I simply can't > be bothered to care about a bikeshed color at this point after being > bounced around for 5 revisions of this patch set. Oh well, we really need this kind of attitude right now. We are all fed up with that mess, but Ingo and I care about the details, consistency and general code quality beyond the current rush to get stuff solved. It's our damned job as maintainers. If you decide you don't care anymore, please let me know, so I can try to free up some cycles to pick up the stuff from where you decided to dump it. Thanks, tglx