Received: by 10.223.185.116 with SMTP id b49csp3828822wrg; Mon, 26 Feb 2018 06:48:01 -0800 (PST) X-Google-Smtp-Source: AH8x227BINmx0USV9nSoHhwhee8YlifescY/CdeJqafMByzSJ0w1CMYTiYylhYZWMwPl3mlk/QiQ X-Received: by 10.98.162.26 with SMTP id m26mr10834447pff.217.1519656481806; Mon, 26 Feb 2018 06:48:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519656481; cv=none; d=google.com; s=arc-20160816; b=JvJ4vsxQ2XEj/n/fTDCFrTpel2c9zOm1CxvwqfBFpteTXyURpse7eeqY9uqdcTyQS7 1aB6q/Pcylpuw9H3ddPGoV4SJ+va0oN8flTlhAdOTVvweIdZxw7cYtuQZcSQdAu1tPWW t3MPXLps/+Dyg2+Hs298wXiUohaQGvVxB/cMUKdhfVTSqDk5lPfFvvCsdwrTLdmzR7jN IFbQSm+jR5O2Asfo90uM8IyvnD6U4tRoMy/wJ+CNvTou8ZFUZiaJdY0WoRTWA/p/lyyJ vXsfzTKGqAfsHscAL6VzL3QgsGyEJa3D3H72L8aLsk+Cb5QWF5uDXNHLO6kygmvTPLBK htcw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=FVYfpF6JnUrj3V8t5QbNyjC4S4c88CmxxrdWud2gO4s=; b=IRKsmX3DiVp4lJK8EXXYq7AVD0vrVv9pEG9I06Q1iupqcfeF/T1wyIXDc3E95ku/1U Pkux8izcZG1vy0YB3E5GJFuzM0QYm2LW0v+tvSLX5JG+njydHP+a4yOkxB/ir4cn/7IM NFozEqGqrCIMttmmt8dXHaEEKQHcFCblUQA4pO2G4+Pj2ODdA5moIuFU9L4GI7h+tTgV B7NbE/Dx/8LT5BL+B0zjDp5imkiZnW03q1ulvnl/5Xal8+KIywxf5jRPmOlOFcMgz+yA AIzJXBO53aOJzQtYSmMUmSuFYChHL+QST0e4rzOSd849W/mr+7lTp7VqT1PsXhBUKeNw YPgg== 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 j5-v6si6860157plt.469.2018.02.26.06.47.47; Mon, 26 Feb 2018 06:48:01 -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 S1753971AbeBZOqW (ORCPT + 99 others); Mon, 26 Feb 2018 09:46:22 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38528 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753418AbeBZOqS (ORCPT ); Mon, 26 Feb 2018 09:46:18 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1EE5240A0971; Mon, 26 Feb 2018 14:46:18 +0000 (UTC) Received: from [10.36.116.142] (ovpn-116-142.ams2.redhat.com [10.36.116.142]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F1DF810E60D7; Mon, 26 Feb 2018 14:46:16 +0000 (UTC) Subject: Re: [PATCH] KVM: X86: Allow userspace to define the microcode version To: Konrad Rzeszutek Wilk Cc: Borislav Petkov , Wanpeng Li , LKML , kvm , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <20180226113000.GC4377@pd.tnic> <20180226114409.GD4377@pd.tnic> <46cecef2-b0fb-b0c2-bbf3-983328d52763@redhat.com> <20180226121509.GE4377@pd.tnic> <24cd527d-5287-f0be-ffe8-eab341bf1d94@redhat.com> <3866d359-0ef8-6a99-6254-84890be62b93@redhat.com> <20180226122205.GG4377@pd.tnic> <20180226143912.GC22024@char.us.oracle.com> From: Paolo Bonzini Message-ID: <9c58dff5-7fed-3fef-d996-56e9460e39b8@redhat.com> Date: Mon, 26 Feb 2018 15:46:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180226143912.GC22024@char.us.oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Feb 2018 14:46:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Feb 2018 14:46:18 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/02/2018 15:39, Konrad Rzeszutek Wilk wrote: > Perhaps both ideas should be done? The one Boris suggested (See below, not > compile tested yet), and also this one? Keep in mind that other hypervisor > offerings (say Xen, VMWare, etc) may have provided the correct microcode > or not and it would be good for the OS to be comfortable running under them. Yes, the patch below is definitely a good idea. Can you send it to Thomas and Ingo? Thanks, Paolo > From 36ea81363c38942057b006ccaf2ef26708a894bb Mon Sep 17 00:00:00 2001 > From: Konrad Rzeszutek Wilk > Date: Mon, 26 Feb 2018 09:35:01 -0500 > Subject: [PATCH] x86/spectre_v2: Don't check bad microcode versions when > running under hypervisors. > > As: > 1) We know they lie about the env anyhow (host mismatch) > 2) Even if the hypervisor (Xen, KVM, VMWare, etc) provided > a valid "correct" value, it all gets to be very murky > when migration happens (do you provide the "new" > microcode of the machine?). > > And in reality the cloud vendors are the ones that should make > sure that the microcode that is running is correct and we should > just sing lalalala and believe them. More "trust" (as the comment says in the code below) than believe. And perhaps the code would be more accurate if it said "hope" instead of "trust". :) Paolo > > Signed-off-by: Konrad Rzeszutek Wilk > --- > arch/x86/kernel/cpu/intel.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c > index d19e903214b4..87d044ce837f 100644 > --- a/arch/x86/kernel/cpu/intel.c > +++ b/arch/x86/kernel/cpu/intel.c > @@ -144,6 +144,13 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c) > { > int i; > > + /* > + * We know that the hypervisor lie to us on the microcode version so > + * we may as well trust that it is running the correct version. > + */ > + if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) > + return false; > + > for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) { > if (c->x86_model == spectre_bad_microcodes[i].model && > c->x86_stepping == spectre_bad_microcodes[i].stepping) >