Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1238516pxa; Thu, 20 Aug 2020 06:28:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVvuChbVvRMS9t8vfvKcZLMEHXIBpHjn0o+NGOphUnsHOfbu5yFOLmQdv4lvRLAGYDF0t5 X-Received: by 2002:a17:906:4b0d:: with SMTP id y13mr1598531eju.39.1597930085654; Thu, 20 Aug 2020 06:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597930085; cv=none; d=google.com; s=arc-20160816; b=wiUgwehM6TXQo2wsWniGczQv4xhPRbxsyTKFnhxh13qtbiOYCsy+JQxCQlhTGERtvT ZdEv52OP62TgSkt9ycPeii6gtyQK48b19kDwYLT9S0ixavSiTS5cIPyjdUqpnQr3MeSf X0AkuiYVZUEoPhpjY0pkxSeaz5GkLhTeTHwms7W6bksknQKaDMzUjvX6cbfGR6ZU1kjx yKzM8olxt1tS0bq4fnfhjPd1Kv8UkEeXd3bKLAmUKwuVsLM1oPdFiMXeQUPVsx85pVTG nYcwfNF2Q3iMbZpGDL+FyCxDci5QDiyLRA3D/xr7BpVvPN5+Xk+lQxwiYpJcMUg0ZBbt GVRg== 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=Lk7Z72RuLxgPRu9GjwrJ1vPZhMQjyEMsiWrrIElfJA0=; b=QEOkmVdsjPuwfDbXKhbdij/aus2yBciFD2kXiDBXcmDQDoR55huZ6ay54gleYiIseS Db3oAF6/a/wmikvRzw/XOdyBEUiHOyFSHACmgxmv0+3mScISfxVeyu4BoouLE786MFd8 t4wDPYePnWBrSMi2J9UAMMdUr1+Vi+DvGp2DHAiHySyoKbYA3arUh+I7VhCVIf09MKk9 ukqUQcV66Q2ZlbgfcxBYvWIZG4wlCJuUGENwpHG0En5rF2c/wgIKaAwqz2qlWlHjcKdf iwazNozCnlqxik9BwC4mFxQdudPBF9sdP17xwt7XGA/W+iOXavpd7LKVhukCLNIPPXKn mJ7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PLvK9UZg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si1264200ejf.232.2020.08.20.06.27.40; Thu, 20 Aug 2020 06:28:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PLvK9UZg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730818AbgHTNZO (ORCPT + 99 others); Thu, 20 Aug 2020 09:25:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:46478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728029AbgHTJeK (ORCPT ); Thu, 20 Aug 2020 05:34:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 BFFA922B4E; Thu, 20 Aug 2020 09:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916025; bh=mS2r6JZi5H4zJrIi0lknmzep8tyuauI0BBhy0kH7gds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLvK9UZg7F56OpGfLb3d6plAW+oWq4iNr4DbooagRcRTsl6ONclAuirevgdrk1hgV /+3d6A5ebKkkoLVbDLOFP6Kq5Sl3evCisdZ/Ecv4JvBPlS8fDU6ISNnXz1JibLJhgb u20IC22FxXcD832WN0DLM52PyIWRsYJ/IxKtjUw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nelson Dsouza , Sean Christopherson , Pawan Gupta , Ingo Molnar , Tony Luck , Thomas Gleixner , Sasha Levin Subject: [PATCH 5.8 190/232] x86/bugs/multihit: Fix mitigation reporting when VMX is not in use Date: Thu, 20 Aug 2020 11:20:41 +0200 Message-Id: <20200820091621.995315719@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@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 [ Upstream commit f29dfa53cc8ae6ad93bae619bcc0bf45cab344f7 ] On systems that have virtualization disabled or unsupported, sysfs mitigation for X86_BUG_ITLB_MULTIHIT is reported incorrectly as: $ cat /sys/devices/system/cpu/vulnerabilities/itlb_multihit KVM: Vulnerable System is not vulnerable to DoS attack from a rogue guest when virtualization is disabled or unsupported in the hardware. Change the mitigation reporting for these cases. Fixes: b8e8c8303ff2 ("kvm: mmu: ITLB_MULTIHIT mitigation") Reported-by: Nelson Dsouza Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson Signed-off-by: Pawan Gupta Signed-off-by: Ingo Molnar Reviewed-by: Tony Luck Acked-by: Thomas Gleixner Link: https://lore.kernel.org/r/0ba029932a816179b9d14a30db38f0f11ef1f166.1594925782.git.pawan.kumar.gupta@linux.intel.com Signed-off-by: Sasha Levin --- Documentation/admin-guide/hw-vuln/multihit.rst | 4 ++++ arch/x86/kernel/cpu/bugs.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/hw-vuln/multihit.rst b/Documentation/admin-guide/hw-vuln/multihit.rst index ba9988d8bce50..140e4cec38c33 100644 --- a/Documentation/admin-guide/hw-vuln/multihit.rst +++ b/Documentation/admin-guide/hw-vuln/multihit.rst @@ -80,6 +80,10 @@ The possible values in this file are: - The processor is not vulnerable. * - KVM: Mitigation: Split huge pages - Software changes mitigate this issue. + * - KVM: Mitigation: VMX unsupported + - KVM is not vulnerable because Virtual Machine Extensions (VMX) is not supported. + * - KVM: Mitigation: VMX disabled + - KVM is not vulnerable because Virtual Machine Extensions (VMX) is disabled. * - KVM: Vulnerable - The processor is vulnerable, but no mitigation enabled diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 0b71970d2d3d2..b0802d45abd30 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "cpu.h" @@ -1556,7 +1557,12 @@ static ssize_t l1tf_show_state(char *buf) static ssize_t itlb_multihit_show_state(char *buf) { - if (itlb_multihit_kvm_mitigation) + if (!boot_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) || + !boot_cpu_has(X86_FEATURE_VMX)) + return sprintf(buf, "KVM: Mitigation: VMX unsupported\n"); + else if (!(cr4_read_shadow() & X86_CR4_VMXE)) + return sprintf(buf, "KVM: Mitigation: VMX disabled\n"); + else if (itlb_multihit_kvm_mitigation) return sprintf(buf, "KVM: Mitigation: Split huge pages\n"); else return sprintf(buf, "KVM: Vulnerable\n"); -- 2.25.1