From patchwork Tue Sep 19 09:45:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 141789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3251490vqi; Tue, 19 Sep 2023 02:49:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnN6AegPlCfK9a86mc9mocMJqDOXs9ZiCYRYdtVw5sUa68uLZBK5LVPs3KWOLOQfdbC1ys X-Received: by 2002:a17:902:d507:b0:1c1:d5d1:a364 with SMTP id b7-20020a170902d50700b001c1d5d1a364mr2888630plg.33.1695116951826; Tue, 19 Sep 2023 02:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695116951; cv=none; d=google.com; s=arc-20160816; b=UTeZINvezJy5lHHXw1CEQo+IrFOB1mVRy9eyTWJNDB5OC6TBeplNiiQY2B60j49tcO eSYM1VFXNbvF6I2FMZdof+z9KrgrRtbToEt5MI+2M88jeacFuH0WhVodz8J/eXx3Yf1X bUKg1DSTN1/mepZ8VDt9aBy30QAaOXbQpLX6JA2TGpknv4tsiWmuoNPbkPmkVXV0X+8E 4GeYsvwrb48BOjbkq1alpAxurkXzXTwinTrWZkfMIrPnooAapNlnCTlMCG/wa7afBUI1 0xClM+wjXCqfLHcpcjd6QRqh1LkkfeXleJ8o6Kk/Yrl4cQJSiIMQc4v22zxOZdmcECuF q+EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=leWaSycILSS4X4zeyzKjCPrPTlKDGdOvZhfx2wmeabs=; fh=4YWXcRT0+UWnMM8DEuWqrO6GNBeEtSiT2VNmZg3JX1Y=; b=AXdbFdMOJ4PRhoj5Y58vL1DBzRxetrLimifz3ahl7Wbo21sqBwKUn20rfaAIjPHDbU 6vYzBoGQc0jTQE7tqaqRebEQ32RweiPfqGbdIQSIEltYcAWDcFSk6aG0joZrZ9o5oOjI FBvpy5JjF3jmkhDCDk7q2DIKeX8Gd3KGu9AuOvQTBEcsvB3IxZi9RT/LL5xHA5HhMjjo hWVxTaLMtGm6uilzkRQ1AYmNIiz5FzjMtJqAhhmwC8z8cA6EYPVO3eS9X3Wv/2cA/A+n PFk8wIJtZk1Ie9rnx1WPcb2lep2m8agP57dD5lZNh5fOgZce48vnp4eT5vBJiWnCAjWt EE8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yX5AdUwE; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lvBRSwrc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j4-20020a170903028400b001bf7289d2b2si9350551plr.315.2023.09.19.02.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 02:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yX5AdUwE; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lvBRSwrc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 188E7809343B; Tue, 19 Sep 2023 02:45:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbjISJpa (ORCPT + 26 others); Tue, 19 Sep 2023 05:45:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231527AbjISJpP (ORCPT ); Tue, 19 Sep 2023 05:45:15 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D52116; Tue, 19 Sep 2023 02:45:08 -0700 (PDT) Date: Tue, 19 Sep 2023 09:45:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695116707; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=leWaSycILSS4X4zeyzKjCPrPTlKDGdOvZhfx2wmeabs=; b=yX5AdUwECepPDFIwnzAi7ZU5hWrVBwX1p27QR8FMdY9ALfF0JSKKv4rDrpM/ck7E2AJQHK lVYQDYqNZ53TOMplGHsyAvaiWaEyFOtV3E/g6wB9zKr0nRRUkR9UFJP/n+QCGMTzhNRc8n tnoaiRe/BhKaYSYpK2k+Q1Uq7DvOZMoMy4/X+/oRC2BInTeXHW6sc0fXJBG8fgdHs6duhU LqMvZwjPNqDFcT2/5vgqH0ksiN2A1IoOypX1Hi2SnF8KGpTFMSDwU4C/YjlyrbTVi8+Hju bbPbQ+Tx83Jrw94oiOH/zSS/wMpBcoSblxTMgQCUZe4ZT1qVhagZpM3p0OIPyA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695116707; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=leWaSycILSS4X4zeyzKjCPrPTlKDGdOvZhfx2wmeabs=; b=lvBRSwrcT/cQrMdNlpLncGf5gy+38kHNZHOXfDrQ1kWihzmGQYJbl+Rn7I0MthfGxm3Xlh Sh04OaRKvx1FltDQ== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/srso: Fix srso_show_state() side effect Cc: Josh Poimboeuf , Ingo Molnar , "Borislav Petkov (AMD)" , Nikolay Borisov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <27d128899cb8aee9eb2b57ddc996742b0c1d776b.1693889988.git.jpoimboe@kernel.org> References: <27d128899cb8aee9eb2b57ddc996742b0c1d776b.1693889988.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <169511670668.27769.1658034763935646312.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 19 Sep 2023 02:45:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777458952887001979 X-GMAIL-MSGID: 1777458952887001979 The following commit has been merged into the x86/urgent branch of tip: Commit-ID: a8cf700c17d9ca6cb8ee7dc5c9330dbac3948237 Gitweb: https://git.kernel.org/tip/a8cf700c17d9ca6cb8ee7dc5c9330dbac3948237 Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:04:45 -07:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 19 Sep 2023 10:53:34 +02:00 x86/srso: Fix srso_show_state() side effect Reading the 'spec_rstack_overflow' sysfs file can trigger an unnecessary MSR write, and possibly even a (handled) exception if the microcode hasn't been updated. Avoid all that by just checking X86_FEATURE_IBPB_BRTYPE instead, which gets set by srso_select_mitigation() if the updated microcode exists. Fixes: fb3bd914b3ec ("x86/srso: Add a Speculative RAS Overflow mitigation") Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Nikolay Borisov Acked-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/27d128899cb8aee9eb2b57ddc996742b0c1d776b.1693889988.git.jpoimboe@kernel.org --- arch/x86/kernel/cpu/bugs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index f081d26..bdd3e29 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -2717,7 +2717,7 @@ static ssize_t srso_show_state(char *buf) return sysfs_emit(buf, "%s%s\n", srso_strings[srso_mitigation], - (cpu_has_ibpb_brtype_microcode() ? "" : ", no microcode")); + boot_cpu_has(X86_FEATURE_IBPB_BRTYPE) ? "" : ", no microcode"); } static ssize_t gds_show_state(char *buf)