Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4126889ybc; Thu, 14 Nov 2019 22:27:59 -0800 (PST) X-Google-Smtp-Source: APXvYqxN0RGTMI30snkkKvxPapenD8kVT8Xtg9+3DveJe1aaxkG/DDCPmwOI+vTOKRhs3+Ekr+YT X-Received: by 2002:a17:906:e0d5:: with SMTP id gl21mr11141374ejb.292.1573799279394; Thu, 14 Nov 2019 22:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573799279; cv=none; d=google.com; s=arc-20160816; b=HlnZfDf5o/f/ozJBwIsg5+gsMS2/vxXYk+uGHYIAywgZKEQBk/1n2UPY0wfy5dK5pa fy7HTbOeyueZMqdQHkBpjzTzgK1b+Q8Cl7IPVdi97BF2zKCpXzMnfgbL14Oh1fln8DlP DqC4luVxU7lNZzZcXiHfgLXMOVZX4qs9OSjaiPOe1jvsD0gHBtqLgF3mFxXfp+rG9QPK 4NkBsIdHpZ4v83QBPBw1PYdsfCkj+PntYiBfM43ZVW8mVNXr6J4Ggxm6vsLuIZkj8ODu A8N6ovKDtLQtemUu6jQvG7+Rjh62jclR2zIIuTKbi/5QZtju9o1fmgUPkRcI59nZblD1 8A7A== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0wm9NSxwshlQvIiypklbcmNtwtSPhWac+3GIyhcIhWI=; b=r4DOfpq1LAV0Z0QWieXRUGCTzvZ8SC5Tn6hZsQQ2QoOBzVmmMstXUtBAFLOT8Ff76Y 4KKdptmW6Aj5onQH1Fjuv1TZfJ+RknYlydSVWlr3WHiTdkXZN5LTSnhgbtIz27ZWIEHn iczfKzkT+MP/00ibUhHoJMEat0o9neU5Ik2xOwyUO3gOO/+4MOZp+GHuqeB671uD+ieC JpbdwisxPHn4/9l3ghtP51dmRqbcZyiAlDe/wIGtB6tMxHXguEHJ8p8I3NJ9EV+D4Wle Gxcn7ryc8rXMxVtvm+Zv1JYLTI79eyvBKRIhFR3Z+xWhlxEPSc92a8G6WR6qqNHw+ye2 usqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="0w4ij/mU"; 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 i33si5968964edc.279.2019.11.14.22.27.35; Thu, 14 Nov 2019 22:27:59 -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; dkim=pass header.i=@kernel.org header.s=default header.b="0w4ij/mU"; 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 S1727428AbfKOGXl (ORCPT + 99 others); Fri, 15 Nov 2019 01:23:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:51992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727744AbfKOGWf (ORCPT ); Fri, 15 Nov 2019 01:22:35 -0500 Received: from localhost (unknown [104.132.150.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7682620801; Fri, 15 Nov 2019 06:22:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573798953; bh=yQgj9nUSMXhIRzKf4KtPw/6VPqUrJf/LMAp1p/aV+Og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0w4ij/mUOmSd9kmGU+FQjxrCgaBpDGHyoED0/QnHYaWs7WrfUHe48UWzspBbdSAkf eLyaecO2DSs1erS2bADMl+Fk5w9yPgdeu5cQpohecSLyySWj0Zai0z9zhsHF5tK/l8 x7TR4dwzfkQX/ihSZOyq+V1M4fh7of0RxMzmow/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pawan Gupta , Borislav Petkov , Thomas Gleixner , Neelima Krishnan , Mark Gross , Tony Luck , Josh Poimboeuf , Ben Hutchings Subject: [PATCH 4.9 06/31] x86/msr: Add the IA32_TSX_CTRL MSR Date: Fri, 15 Nov 2019 14:20:35 +0800 Message-Id: <20191115062011.497215220@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191115062009.813108457@linuxfoundation.org> References: <20191115062009.813108457@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pawan Gupta commit c2955f270a84762343000f103e0640d29c7a96f3 upstream. Transactional Synchronization Extensions (TSX) may be used on certain processors as part of a speculative side channel attack. A microcode update for existing processors that are vulnerable to this attack will add a new MSR - IA32_TSX_CTRL to allow the system administrator the option to disable TSX as one of the possible mitigations. The CPUs which get this new MSR after a microcode upgrade are the ones which do not set MSR_IA32_ARCH_CAPABILITIES.MDS_NO (bit 5) because those CPUs have CPUID.MD_CLEAR, i.e., the VERW implementation which clears all CPU buffers takes care of the TAA case as well. [ Note that future processors that are not vulnerable will also support the IA32_TSX_CTRL MSR. ] Add defines for the new IA32_TSX_CTRL MSR and its bits. TSX has two sub-features: 1. Restricted Transactional Memory (RTM) is an explicitly-used feature where new instructions begin and end TSX transactions. 2. Hardware Lock Elision (HLE) is implicitly used when certain kinds of "old" style locks are used by software. Bit 7 of the IA32_ARCH_CAPABILITIES indicates the presence of the IA32_TSX_CTRL MSR. There are two control bits in IA32_TSX_CTRL MSR: Bit 0: When set, it disables the Restricted Transactional Memory (RTM) sub-feature of TSX (will force all transactions to abort on the XBEGIN instruction). Bit 1: When set, it disables the enumeration of the RTM and HLE feature (i.e. it will make CPUID(EAX=7).EBX{bit4} and CPUID(EAX=7).EBX{bit11} read as 0). The other TSX sub-feature, Hardware Lock Elision (HLE), is unconditionally disabled by the new microcode but still enumerated as present by CPUID(EAX=7).EBX{bit4}, unless disabled by IA32_TSX_CTRL_MSR[1] - TSX_CTRL_CPUID_CLEAR. Signed-off-by: Pawan Gupta Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Tested-by: Neelima Krishnan Reviewed-by: Mark Gross Reviewed-by: Tony Luck Reviewed-by: Josh Poimboeuf Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/msr-index.h | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -77,6 +77,7 @@ * Microarchitectural Data * Sampling (MDS) vulnerabilities. */ +#define ARCH_CAP_TSX_CTRL_MSR BIT(7) /* MSR for TSX control is available. */ #define MSR_IA32_FLUSH_CMD 0x0000010b #define L1D_FLUSH BIT(0) /* @@ -87,6 +88,10 @@ #define MSR_IA32_BBL_CR_CTL 0x00000119 #define MSR_IA32_BBL_CR_CTL3 0x0000011e +#define MSR_IA32_TSX_CTRL 0x00000122 +#define TSX_CTRL_RTM_DISABLE BIT(0) /* Disable RTM feature */ +#define TSX_CTRL_CPUID_CLEAR BIT(1) /* Disable TSX enumeration */ + #define MSR_IA32_SYSENTER_CS 0x00000174 #define MSR_IA32_SYSENTER_ESP 0x00000175 #define MSR_IA32_SYSENTER_EIP 0x00000176