Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2301020imc; Tue, 12 Mar 2019 10:56:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAMuCqs65qtJjvRRmCi+qHS67+/CHDRyA83ptsAJfAGk/X2Z5ZUMrTytXdirrGS93+YzuA X-Received: by 2002:a65:4342:: with SMTP id k2mr20892577pgq.445.1552413372633; Tue, 12 Mar 2019 10:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413372; cv=none; d=google.com; s=arc-20160816; b=ZyAQFkl9sRald9VCpD+wuigfWVBh7ziv8Y5NssZ1yK3Wm/OyaAWmkr5DjiSXlbVd+d dhoucjnLcD5WDWph9X93Z5GgYUC0MfLrX+X4RDAgwiUCRT+t0eQzPMR1HtVViHhMsqTz xzpOJGlaXCUnMruwErnbMWLBy4+S8ard/rmnf2Zq4kxfiuX0ppe/e0POq4LIHs3TDpYe 2ubeht2mAM4abV/a1P5GLdmmYI8Lu9upwnTg6yGOwdF0pMm2QxvJ6YtoK3DGgJ4tBTxJ /0NVC9fmw7CgZ0QWxZgPcmWJGnikVF6PQNw/ZlbvGS7Wk0BiMLtdm3F820S411efpXrE r5bA== 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=U4Ltk1yqzbhtCMVPfzcB48khZ54olu1SH53JcXLRnck=; b=P6pD2YKYDUoquxfegNzfU+b5DuEnwrm8kIFu58AeQoVlQ2RYkgfht0Q2x/3dyvky0V vWwmmOgTgeGP+erYBMnbyncCMEURJY6uYVmEE1Afzq/i8ZLVPVR8MlokY5zPr3pq8Xrg pX3zasGqK76UsaOOAgRHsCIGYAK+eOCl7mCcELzBbBelDjyPIyjFZYCm9mnnpWW++D5U G6gLoDIFcYGxwsADTSsUyFZz/VAJkCuWt9wHAWjn0LTnhXWLxkB0SkU4tbr0qlJsnGZb Ea8f1UC8ku7ttOMWky6S+VZbl888ycFdmaJqXixYzZj8T+k9PHYh11MF+sVzjBhwL7EQ PzAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YQuUwsIz; 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 y18si7956321pgf.247.2019.03.12.10.55.56; Tue, 12 Mar 2019 10:56:12 -0700 (PDT) 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=YQuUwsIz; 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 S1729569AbfCLRxr (ORCPT + 99 others); Tue, 12 Mar 2019 13:53:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:52544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728276AbfCLROO (ORCPT ); Tue, 12 Mar 2019 13:14:14 -0400 Received: from localhost (unknown [104.133.8.98]) (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 DB67E2173C; Tue, 12 Mar 2019 17:14:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552410854; bh=S4Nnv6JZp6dY9VawqO3zd1D5zWAx0M7vB0neWOwJzaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YQuUwsIzN3ywtM5sepjeYbsrLdLq1AKZF12Rt5jgU898RS+kWyUBknXO9Qi63DkNQ BwzgVTK3CrfQQRp9i1V+WlhFDOQPA4MfLpwKiBCvFlaJNUdnur27rqILYen2qFrPd9 ypNAPf2kcf4gpxUMN0yKmmDYbcpxTKcVYfcsiadg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , Thomas Gleixner , x86-ml , Sasha Levin Subject: [PATCH 4.19 049/149] x86/microcode/amd: Dont falsely trick the late loading mechanism Date: Tue, 12 Mar 2019 10:07:47 -0700 Message-Id: <20190312170353.883748154@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312170349.421581206@linuxfoundation.org> References: <20190312170349.421581206@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 912139cfbfa6a2bc1da052314d2c29338dae1f6a ] The load_microcode_amd() function searches for microcode patches and attempts to apply a microcode patch if it is of different level than the currently installed level. While the processor won't actually load a level that is less than what is already installed, the logic wrongly returns UCODE_NEW thus signaling to its caller reload_store() that a late loading should be attempted. If the file-system contains an older microcode revision than what is currently running, such a late microcode reload can result in these misleading messages: x86/CPU: CPU features have changed after loading microcode, but might not take effect. x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update. These messages were issued on a system where SME/SEV are not enabled by the BIOS (MSR C001_0010[23] = 0b) because during boot, early_detect_mem_encrypt() is called and cleared the SME and SEV features in this case. However, after the wrong late load attempt, get_cpu_cap() is called and reloads the SME and SEV feature bits, resulting in the messages. Update the microcode level check to not attempt microcode loading if the current level is greater than(!) and not only equal to the current patch level. [ bp: massage commit message. ] Fixes: 2613f36ed965 ("x86/microcode: Attempt late loading only when new microcode is present") Signed-off-by: Tom Lendacky Signed-off-by: Borislav Petkov Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Thomas Gleixner Cc: x86-ml Link: https://lkml.kernel.org/r/154894518427.9406.8246222496874202773.stgit@tlendack-t1.amdoffice.net Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/microcode/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 07b5fc00b188..a4e7e100ed26 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -707,7 +707,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) if (!p) { return ret; } else { - if (boot_cpu_data.microcode == p->patch_id) + if (boot_cpu_data.microcode >= p->patch_id) return ret; ret = UCODE_NEW; -- 2.19.1