Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2310507imc; Tue, 12 Mar 2019 11:07:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6bvLX92JvsvuE+E46qwcYljKGQ371k6bOCtgqNX1Vf84jb/DJTfiTDMnVDwp+gLLU8Gix X-Received: by 2002:a17:902:2963:: with SMTP id g90mr41591536plb.182.1552414023009; Tue, 12 Mar 2019 11:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552414023; cv=none; d=google.com; s=arc-20160816; b=wNyi/rUsq+Ti9stNGuuFaar+myKJyyc+sCFHVDO84TABnrHEP68bxc0mJaN0lm91mF GihGDZfn540TPn8B03Lnu8H+FDPpzzaITPwhpMh++bddmGyS2Wr1ypDK6F16WmvF8f1O +h5aC7Un+WNX5ulsPEzI5ifquTr+tTWCKAnb76mCsUhyhTpl4lX7iWHm2ZbK7QXgepoC gWrbBVEzXebLcBdpPD9vzqoudtx8fvl0tl4Ja8xG7ILHEcznnp+AWAgEobOLTJHYLF71 ucSuoQCpjAcKyKDp+YKPy5sb2UIJ2N/CVzhDq+PFCbWYRUndo76hrXW+7eFjYQyldYli mcVg== 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=U5G0HB/1zJZ86ibBgs7ld6vk0YG9eJ7vu+jyrtqz1qk=; b=wmrcAeI0AlJLEnqOueYjiBB3Fo/Ea++m/iZ+A9KdRsxFHLw2ie2jLOveSGXrfct9pm /ejARwr0CCl1HdOOliPpQNj06KsY6L+yXcUgNVLJ4bI04MOu4eMOHA9xOBTn3qt5ct/y v5cAbZDj76i7iNfagQa6FsMcKE+I/QKvGean8ECalpUrkGNCqNHmW0Rf9FNcFNPAXSHD /LlozsaqsgxyHQF2ukayR6KS7S3yJz0ovZgsLZCouFKHglHb2pG1QbkiDP7rDbvA4uoP YtdrXwMEAUKeVI1jYYu3/HizRezKL1y0KN3b49UZAsbF5CBxOulwgwksD23+M4gLh9FU g/CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xm1RdGLk; 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 l94si8815634plb.209.2019.03.12.11.06.47; Tue, 12 Mar 2019 11:07:02 -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=Xm1RdGLk; 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 S1727560AbfCLRMg (ORCPT + 99 others); Tue, 12 Mar 2019 13:12:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:47100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727356AbfCLRMQ (ORCPT ); Tue, 12 Mar 2019 13:12:16 -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 5DF02206DF; Tue, 12 Mar 2019 17:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552410735; bh=1tqwP6ZmT9pyoF5lTfbMdEg+7hy6VWcWe59fJ+ueb2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xm1RdGLkSuLY3YL0m/qyHaWETd7yu4YpcK2RiMzSUG3+tjZRAd/MHxazb79z5UVM4 6iJZr1nOxcK++KXgZmTXwxiTq6sadhMmKC6xnH+Un41Psjfbbuoq/ADC5QKhZsDOVL q0UfqHVfDVM385HpE5x5JYZNmH9bnruZdgcSOtCI= 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.20 056/171] x86/microcode/amd: Dont falsely trick the late loading mechanism Date: Tue, 12 Mar 2019 10:07:16 -0700 Message-Id: <20190312170352.966350589@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312170347.868927101@linuxfoundation.org> References: <20190312170347.868927101@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.20-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