Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1388788rwd; Thu, 15 Jun 2023 09:51:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+9mlieDVi4CkVcFzugvxKu6CgUDA1GPIeg2NqVtKcoeRemdf4iaSXbhVXszPX61Q3Ee2b X-Received: by 2002:a17:902:da8c:b0:1ae:4562:14f1 with SMTP id j12-20020a170902da8c00b001ae456214f1mr17046366plx.9.1686847908167; Thu, 15 Jun 2023 09:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686847908; cv=none; d=google.com; s=arc-20160816; b=oT+C9unyL27YXYKBQVHnHRYLNDgPHi/D17YCvhh23jUF06qoVfNexKIq/jOeeLMAhx QLaw3D+gOkIvhPA82mevTYKskN7TzNkm1EIdgSbIwvwdfy+utSr2//ZKkAwHFW0wROzn bj7eyuba1ZGiI2Rh+39pK9M36pQaYwMg/eEqBJYBKvOLOxLekgCIu2fYAMbXayUmyS30 SzVRN063SatTCHant5V0ynt+HwiP33H0F1VOyUNryPGTEH4K15NXm9DHgvY55gR2S4lZ o6+cOgFc4DJ2St1CV56Bm+NaTYDLq/ejwfNTXhmOFOQ8QjOPPpRD2BDIIzsvxJJxxw50 Y+TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=0LSIDuAzGUjwULNEFFLWoff2MIu4uiigVl6eBKjinCo=; b=GkpRWRXSmCr1ik6nZ8Fuv3hl2SDTbVIBLAa2LEb7tFqI+4U8+mHt3BObiXtIpXSULl 3wyQs1Y/NE2iYdQM3nVHAl6ZTZ1VmfpyiBNxSj+9bLvkEfXnSU/coh7FeTnBp+uSvYE7 h+rrsjpE+Lv83TZm1jUr0MUSZeeSdTktEy1yRruxyAwSFTndudJb8y/8Y6PK1vyFeqAu /L7oqjgSNXtx0EAmegdjLbSiMhwNUhJBJSoue8CAr2WzJ/nIA5Ugcn618Odclq0VWbPJ WJ7SJZRTLItuCVoSpaWadWmqq8v/Lv4B9EXW+oU08wvv6PbvisdNf4leFnbuUBkz8Suc SeQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a170902e5c100b001b047410425si13508793plf.503.2023.06.15.09.51.35; Thu, 15 Jun 2023 09:51:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237077AbjFOQpl (ORCPT + 99 others); Thu, 15 Jun 2023 12:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237188AbjFOQpA (ORCPT ); Thu, 15 Jun 2023 12:45:00 -0400 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC8F53590 for ; Thu, 15 Jun 2023 09:44:37 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2b4470e1500so12167911fa.1 for ; Thu, 15 Jun 2023 09:44:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686847476; x=1689439476; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0LSIDuAzGUjwULNEFFLWoff2MIu4uiigVl6eBKjinCo=; b=CPAnbxpwtfqlBayL9sHpYGgnC+f7w+Vj7Q3286vJdWis0ZeWkObFo9tgWBlFKuwblV M8IiwwkPQBcPXwJ3LZElvpco29ASkJo5om5TT+VMJwOqpAmPkzwvzRN8miLFRFmbAEdi dpowGxLm6i/fBrxA3b9M9s6g8t1AWuCGWXjyjyO85jCz8qRJwOpj1IlREFcB3lc0gM36 Grzt3+6Dtcv8e2dPKOHDFYMSZouR/T0zU0h+S1VYi4cid+kiA0MszqszJG038nkR2nWg S5aARFN/Lm52iK81dLRUAqb9B8siWMaMbBdmK0QVDksbPXUdoRBJjMIQYORbNEImCXIz ng6A== X-Gm-Message-State: AC+VfDwMBzfrFOp7PQOCOatctZHDpaU/MXT4W4mPxHJEziSGIZ9qLq/5 Upzp5S+9u1GKCWa+pI0WwSY= X-Received: by 2002:a2e:90cd:0:b0:2ac:8261:5f4b with SMTP id o13-20020a2e90cd000000b002ac82615f4bmr5658ljg.28.1686847476025; Thu, 15 Jun 2023 09:44:36 -0700 (PDT) Received: from localhost (fwdproxy-cln-011.fbsv.net. [2a03:2880:31ff:b::face:b00c]) by smtp.gmail.com with ESMTPSA id m1-20020a5d4a01000000b003062ad45243sm21533276wrq.14.2023.06.15.09.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 09:44:35 -0700 (PDT) From: Breno Leitao To: pawan.kumar.gupta@linux.intel.com, jpoimboe@kernel.org, peterz@infradead.org, tglx@linutronix.de, bp@alien8.de, Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: leit@fb.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] x86/speculation: Print error when mitigations are disabled Date: Thu, 15 Jun 2023 09:44:17 -0700 Message-Id: <20230615164417.3588162-7-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230615164417.3588162-1-leitao@debian.org> References: <20230615164417.3588162-1-leitao@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If mitigations are disabled for MDS, TAA, MMIO we want to let users aware. This is either disabled by "mitigations=off" kernel argument, or, by CONFIG_SPECULATION_MITIGATIONS=n Signed-off-by: Breno Leitao --- arch/x86/kernel/cpu/bugs.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 703649a29181..b678cdd95dc1 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -275,6 +275,7 @@ static void x86_amd_ssb_disable(void) /* Default mitigation for MDS-affected CPUs */ static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL; static bool mds_nosmt __ro_after_init = false; +#define MDS_WARN_MSG "WARNING: Microarchitectural Data Sampling (MDS) speculative mitigation disabled!\n" static const char * const mds_strings[] = { [MDS_MITIGATION_OFF] = "Vulnerable", @@ -284,11 +285,16 @@ static const char * const mds_strings[] = { static void __init mds_select_mitigation(void) { - if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_speculative_mitigations_off()) { + if (!boot_cpu_has_bug(X86_BUG_MDS)) { mds_mitigation = MDS_MITIGATION_OFF; return; } + if (cpu_speculative_mitigations_off()) { + pr_err(MDS_WARN_MSG); + mds_mitigation = MDS_MITIGATION_OFF; + } + if (mds_mitigation == MDS_MITIGATION_FULL) { if (!boot_cpu_has(X86_FEATURE_MD_CLEAR)) mds_mitigation = MDS_MITIGATION_VMWERV; @@ -335,6 +341,7 @@ enum taa_mitigations { /* Default mitigation for TAA-affected CPUs */ static enum taa_mitigations taa_mitigation __ro_after_init = TAA_MITIGATION_VERW; static bool taa_nosmt __ro_after_init; +#define TAA_WARN_MSG "WARNING: TSX Asynchronous Abort (TAA) speculative mitigation disabled!\n" static const char * const taa_strings[] = { [TAA_MITIGATION_OFF] = "Vulnerable", @@ -359,6 +366,7 @@ static void __init taa_select_mitigation(void) } if (cpu_speculative_mitigations_off()) { + pr_err(TAA_WARN_MSG); taa_mitigation = TAA_MITIGATION_OFF; return; } @@ -436,6 +444,7 @@ enum mmio_mitigations { /* Default mitigation for Processor MMIO Stale Data vulnerabilities */ static enum mmio_mitigations mmio_mitigation __ro_after_init = MMIO_MITIGATION_VERW; static bool mmio_nosmt __ro_after_init = false; +#define MMIO_WARN_MSG "WARNING: MMIO Stale Data speculative mitigation disabled!\n" static const char * const mmio_strings[] = { [MMIO_MITIGATION_OFF] = "Vulnerable", @@ -448,12 +457,16 @@ static void __init mmio_select_mitigation(void) u64 ia32_cap; if (!boot_cpu_has_bug(X86_BUG_MMIO_STALE_DATA) || - boot_cpu_has_bug(X86_BUG_MMIO_UNKNOWN) || - cpu_speculative_mitigations_off()) { + boot_cpu_has_bug(X86_BUG_MMIO_UNKNOWN)) { mmio_mitigation = MMIO_MITIGATION_OFF; return; } + if (cpu_speculative_mitigations_off()) { + pr_err(MMIO_WARN_MSG); + mmio_mitigation = MMIO_MITIGATION_OFF; + } + if (mmio_mitigation == MMIO_MITIGATION_OFF) return; -- 2.34.1