Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp1132002rdb; Sun, 20 Aug 2023 19:35:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVkFEvRRxsOJP4lC2mdun/XsV5oUKpRP/6ABmGORC21RFwO7YUc+7rPIkoYpOMpA8pSfgG X-Received: by 2002:a17:907:7623:b0:99d:f0e8:5623 with SMTP id jy3-20020a170907762300b0099df0e85623mr3656789ejc.54.1692585349255; Sun, 20 Aug 2023 19:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692585349; cv=none; d=google.com; s=arc-20160816; b=L+qbsUUZt/fbxfR5eCMzRKjItx9wsC4qc2N7GdKLcpHJuGQnu0AZYuoLNQT+e0Wp5j Bb2VGYN3H1PjWI/o/NLh0F8l0XjQpG0MWB+C13bdHbq9kwmBK9LUjJBPT9huD+vwRH2h nkF9pubf1Cg8bXNfnTkTG/l/pC41rAMwHpCEKgrKvOAT/At6ZcBviMukQFWACNg1958W TqNC8ABrN3zB36h1/tMybh0t1lxdwUYeVt0cxjgwzBs0sGTUV6V/k+AIh46KxCeAZpzw k+dqsNnHRWmzWvGbSVqiQtrEJzsnVncsQg4rPWBBVL3KumRTkanDfuiUn6drRc5Zvtu5 +WCQ== 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 :dkim-signature; bh=WpYnraIgbpbJGAAYEIQCz7RidN8m0w8NOh8GTMtxyHw=; fh=1KVrD/LnRsN9N7k2d12iARV4DA2tVMW012QtKSrD46c=; b=ScRK10bHhsY7PpHDaq9HiRm/j7rJPEZvzJ68p+GRc5tQBLP/Pap2cedX1WLlVkGb3L xvfjFHm1rhQ8xZu6ljHgpcxS4b7Qp4IM1Wo5mw2cvEOOu3UazTSBJwtctZU8tM2DRSfQ 38bEFZNoUt1BlzXqobTYzPlfNcauXnhXQP0a/KGbauZ6kh/FaD0WasboAG04zulhMNdT psjibyxH6yaorHF/cSKAX02t8PYvYYmV7CYeJAqIHNaI5AwOex3w9PkvA6Qc5/1WUiEV qP1YspwCsHzHt3L2pVVzsAaHbSGbJ1/w2lsjkuUIAJqiWo35v/nhZRpEwysTAa2/0JJQ jvZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oGTzd7iR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s25-20020a1709066c9900b0099ca94b4d01si5034427ejr.705.2023.08.20.19.35.24; Sun, 20 Aug 2023 19:35:49 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oGTzd7iR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232278AbjHUBTb (ORCPT + 99 others); Sun, 20 Aug 2023 21:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231990AbjHUBTa (ORCPT ); Sun, 20 Aug 2023 21:19:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7396A0 for ; Sun, 20 Aug 2023 18:19:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4E4C8625FD for ; Mon, 21 Aug 2023 01:19:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 429C3C433C7; Mon, 21 Aug 2023 01:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692580767; bh=tZ4Q8jjAOGCCPRfVNc3rr+aMQROmytBONCwejjFqKCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oGTzd7iRf/KPOJw0aXefKaYcg8H6TV5xkkITQZwWCdz/IBieIjDZ3b9OcfkhMjGtZ V2abQsFrOYW+v8OYpnMkELoen6RT6Y/ZVwuRUqB6pfgrBvahjo7bnv/GlmDzX35LeG TJo55qbD7gekM5AiVxQqShYQQQ9KAUb+0EvgauRUThuSWDf/+cpsbAKu51VGOX131f 2Vs09GZFnyadGVT/64GC3mY+Kqazu3ZiaYuiLQGwYUbofZ4REnhILiv4C2aBGL9CUx K9o/Swr+FjhmzO8+M6oL8VRF0i0YO2r6+IgjryOvdvraP1zIMV9GsBj+Hs146t2EAT ppu/1Da+Mflaw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Borislav Petkov , Peter Zijlstra , Babu Moger , Paolo Bonzini , Sean Christopherson , David.Kaplan@amd.com, Andrew Cooper , Nikolay Borisov , gregkh@linuxfoundation.org, Thomas Gleixner Subject: [PATCH 01/22] x86/srso: Fix srso_show_state() side effect Date: Sun, 20 Aug 2023 18:18:58 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 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 --- 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 f081d26616ac..bdd3e296f72b 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) -- 2.41.0