Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751970AbeADBvM (ORCPT + 1 other); Wed, 3 Jan 2018 20:51:12 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:44759 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751727AbeADBvL (ORCPT ); Wed, 3 Jan 2018 20:51:11 -0500 X-Google-Smtp-Source: ACJfBotdvXtMA83i40g14RgZUXEvpaWYJff9WloGNUJYyWFGD7cgNXOku+Pb+iKB3tCSsGc6zcL0QsBpF2Xy8VM8KJ4= MIME-Version: 1.0 In-Reply-To: References: <20180103223827.39601-1-mark.rutland@arm.com> <151502463248.33513.5960736946233335087.stgit@dwillia2-desk3.amr.corp.intel.com> <20180104010754.22ca6a74@alans-desktop> From: Dan Williams Date: Wed, 3 Jan 2018 17:51:09 -0800 Message-ID: Subject: Re: [RFC PATCH] asm/generic: introduce if_nospec and nospec_barrier To: Jiri Kosina Cc: Alan Cox , Linus Torvalds , Linux Kernel Mailing List , Mark Rutland , linux-arch@vger.kernel.org, Peter Zijlstra , Greg KH , Thomas Gleixner , Elena Reshetova , Alan Cox Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Jan 3, 2018 at 5:27 PM, Jiri Kosina wrote: > On Thu, 4 Jan 2018, Alan Cox wrote: > >> There are people trying to tune coverity and other tool rules to identify >> cases, > > Yeah, but that (and *especially* Coverity) is so inconvenient to be > applied to each and every patch ... that this is not the way to go. > > If the CPU speculation can cause these kinds of side-effects, it just must > not happen, full stop. OS trying to work it around is just a whack-a-mole > (which we can apply for old silicon, sure ... but not something that > becomes a new standard) that's never going to lead to any ultimate > solution. Speaking from a purely Linux kernel maintenance process perspective we play wack-a-mole with missed endian conversions and other bugs that coccinelle, sparse, etc help us catch. So this is in that same category, but yes, it's inconvenient. Alan already mentioned potential compiler changes and annotating variables so that the compiler can help in the future, but until then we need these explicit checks. Elena has done the work of auditing static analysis reports to a dozen or so locations that need some 'nospec' handling. The point of this RFC is to level set across architectures on the macros/names/mechanisms that should be used for the first round of fixes.