From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FDBEC433F5 for ; Wed, 25 May 2022 12:52:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237067AbiEYMwd (ORCPT ); Wed, 25 May 2022 08:52:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235210AbiEYMwb (ORCPT ); Wed, 25 May 2022 08:52:31 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28BED2DD8 for ; Wed, 25 May 2022 05:52:30 -0700 (PDT) Received: from zn.tnic (p200300ea97465795329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9746:5795:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 5B84B1EC026E; Wed, 25 May 2022 14:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1653483144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=AOSTJBauf+qqXFyC6kg1/giRfPjYgn+7xUx+q+nWFvo=; b=GjqTegaNU8V3ycIEJkTu2/vzCjwn5sKdGm3ueqy2k/DL1gvlyHWRWrj83+9qaFB9HtzWYH vjNsrDamdLsoOHS48+v3TCtLhvz68ZKIcqAz6iTSUqWZRm+iJU4PmS5J0krr3+ws41jF9n W7V0XpqmobnmVx9xQjn88z/VUF8V8+c= Date: Wed, 25 May 2022 14:52:20 +0200 From: Borislav Petkov To: Peter Zijlstra Cc: X86 ML , LKML Subject: [RFC PATCH -v2] x86/microcode: Taint and warn on late loading Message-ID: References: <20220524185324.28395-1-bp@alien8.de> <20220524185324.28395-4-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 25, 2022 at 12:03:52PM +0200, Peter Zijlstra wrote: > Should we not warn *before* attempting the ucode update? Should the > whole thing come unstuck, you at least have some clue. Sure. From: Borislav Petkov Warn before it is attempted and taint the kernel. Signed-off-by: Borislav Petkov --- arch/x86/kernel/cpu/microcode/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index c717db6b6856..801b44ac3851 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -493,6 +493,9 @@ static int microcode_reload_late(void) { int ret; + pr_err("Attempting late microcode loading - it is dangerous and taints the kernel.\n"); + pr_err("You should switch to early loading, if possible.\n"); + atomic_set(&late_cpus_in, 0); atomic_set(&late_cpus_out, 0); @@ -541,6 +544,8 @@ static ssize_t reload_store(struct device *dev, if (ret == 0) ret = size; + add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); + return ret; } -- 2.35.1 -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette