Received: by 10.223.148.5 with SMTP id 5csp7714204wrq; Thu, 18 Jan 2018 08:38:51 -0800 (PST) X-Google-Smtp-Source: ACJfBouWLHBxZE6U74qQ8NqgbROBy8PkmbDADMJM98j6li9Av6+4EEHApXMqMCo1Vr5QTE6p4PMN X-Received: by 10.98.238.18 with SMTP id e18mr42842467pfi.23.1516293531103; Thu, 18 Jan 2018 08:38:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516293531; cv=none; d=google.com; s=arc-20160816; b=UqI+x0VvlTXaTlO2heeX9X/Umpc7LvqOQPOIpdiGlx7Vodnkx7MiDSUKU8g7njBnNd JlZKz6tDKYilPB8yrIYrNqim8MIKkqhQg0MabUckvB3DNIHSXn5ZvayuTmbb+zk9jzF2 pK28x49j/GJrPJQuD4Lu6IY6zyr3pY3sPWJSPWSZizOYSDwz6QBtn65ejfgcxUoF2UQM aQi2aYzj2ttu60KZep+IcPHlYS+wG809RkhW/2WrkA0eFbpUzApPfSwr+OgNN09R0mCO RY+3ZmA4uAlItP6JTQlpAn+RgD/x3TpUDBYVIP9z36eOsMFnqDhuVHCii/btZFO+X5/m xI2w== 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:cc :to:from:date:arc-authentication-results; bh=BHn73+l1dR80d8BcY92EyI7lXaSn2wqLljnm9Tfy8og=; b=fsIwt5qgHgRNY10kIgiFIFhDX5irv0vqLUEoAv4aB0POgBYYl/SzjG8iIaN5tBv0n3 XyTozhkkbBe+2nCyfkYIWoX3LVyIQ+QkUcMI7HAh2YW8j01sC3NwNgYrQN3Jm7gdvG7F E6pnm/iWm8UxaFQPEbOYAFwGwgFFsd8bXm9m6AB8aawE9k8fC/6TBZUHcuS7YeUXxJ3D htpS1O/MFldSFAqks4Vfp5GIBVAtJa6z4RrBKvyNFUWK5HhIsHdW3NWbmX/U9YGC6kS6 xYhSmqt/2JUP1s/NKLT8qxtT21aY1lhsdzBgBhGlB8vd5JfKN+B4tkZ8H7DxGDF6WJDB 7NCA== 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 g6-v6si21496plj.709.2018.01.18.08.38.37; Thu, 18 Jan 2018 08:38:51 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755321AbeARQh7 (ORCPT + 99 others); Thu, 18 Jan 2018 11:37:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59328 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755206AbeARQh4 (ORCPT ); Thu, 18 Jan 2018 11:37:56 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8051878552; Thu, 18 Jan 2018 16:37:55 +0000 (UTC) Received: from treble (ovpn-126-50.rdu2.redhat.com [10.10.126.50]) by smtp.corp.redhat.com (Postfix) with SMTP id 3A78917DC0; Thu, 18 Jan 2018 16:37:46 +0000 (UTC) Date: Thu, 18 Jan 2018 10:37:45 -0600 From: Josh Poimboeuf To: Peter Zijlstra Cc: David Woodhouse , Thomas Gleixner , linux-kernel@vger.kernel.org, Dave Hansen , Ashok Raj , Tim Chen , Andy Lutomirski , Linus Torvalds , Greg KH , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , Dan Williams , Paolo Bonzini , Jun Nakajima , Asit Mallick , Jason Baron Subject: Re: [PATCH 23/35] x86/speculation: Add basic speculation control code Message-ID: <20180118163745.t5nmwdr53wjsl7o5@treble> References: <20180118134800.711245485@infradead.org> <20180118140152.830682032@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180118140152.830682032@infradead.org> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 18 Jan 2018 16:37:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 18, 2018 at 02:48:23PM +0100, Peter Zijlstra wrote: > From: Thomas Gleixner > > Add the minimal infrastructure to control the speculation control feature. > > - Integrate it into the spectre_v2 coammand line parser and the mitigation > selector function. The conditional selector function is a placeholder > right now, which needs to be expanded with CPU specific decision > functions. > > - Provide a static key for the actual code control. > > - Provide a init function which is called after jump label patching is > functional. > > - Provide an interface for the late micro code loader to allow late > discovery of the IBRS support. Not yet functional. > > [peterz: fixed Makefile] > > Signed-off-by: Thomas Gleixner > Signed-off-by: Peter Zijlstra (Intel) > --- > Documentation/admin-guide/kernel-parameters.txt | 1 > arch/x86/include/asm/nospec-branch.h | 5 +++ > arch/x86/kernel/cpu/Makefile | 1 > arch/x86/kernel/cpu/bugs.c | 26 +++++++++++++++++- > arch/x86/kernel/cpu/specctrl.c | 33 ++++++++++++++++++++++++ > 5 files changed, 64 insertions(+), 2 deletions(-) > > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -3932,6 +3932,7 @@ > retpoline - replace indirect branches > retpoline,generic - google's original retpoline > retpoline,amd - AMD-specific minimal thunk > + ibrs - Intel: Indirect Branch Restricted Speculation Are there plans to add spectre_v2=ibrs_always to prevent SMT-based attacks? > --- /dev/null > +++ b/arch/x86/kernel/cpu/specctrl.c > @@ -0,0 +1,33 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +#include > +#include > +#include > + > +static inline void specctrl_enable_ibrs(void) > +{ > + setup_force_cpu_cap(X86_FEATURE_IBRS); > +} "spec_ctrl" seems much more readable than specctrl (for both function and file names). And also more consistent with the SPEC_CTRL MSR and FEATURE names. -- Josh