Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp813658rdb; Fri, 25 Aug 2023 01:39:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnk+aOEYSTmEXoCX47qN9jnlQyuiBupEC3pF60ozeMkZeQZBvaQj7pELtsm7g5iU2RuF8V X-Received: by 2002:a05:6402:786:b0:523:b665:e494 with SMTP id d6-20020a056402078600b00523b665e494mr11426964edy.15.1692952761764; Fri, 25 Aug 2023 01:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692952761; cv=none; d=google.com; s=arc-20160816; b=sfTopQhfuQnuGo1jRBfgtsl+3tfRhmFVmpL6AIK1WrpLm3imXH+CgZp+AVfCtoBJbR lWfHqDFw7n3vTkyPoZzgzbE+CziT41tiJHl1yWHPac0EAY/7XONXyNM9kpC3VCxBfQZz OW4oLTsSC50I0IUKmtdMespImHN9RvjrmDHwnqtj+Rlf/8LbbxB93E0oGuqVZZepgLWW RVqs1P0CkLnInYjnjbF0LlMqU/btDV9dsizJHtFaIGpN7WpRU2g6fAn0tOe8vmQdhYQL GDj3PBNHcMcRws930CpiVV4sAkTlz2OpJC0kQw9blb2LikOYxubqVlLSWA9AHZxgUaSC 14kg== 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=SMpM8T/L/4XXKxS6RBD6LR7nMkGy4paTzd4HzppK/1M=; fh=ZwaEcDYNCnlh+U7YxZ1LCEcet9pcdhSkEX0cCEOksvY=; b=fwbIkXnl9HE/e8eO8ZEDObp4ufhOqIgizeYDxAWrj89AFVfEEgpykkbCZVaGnO8ymC JaSo9IezKd4mGfIpsc1FMYCmGrMMz7RLsewriSNyd7+XuJVSC4S9IxkVC9nd1fvD2HMj FYnVS9K+HyvP6UxmfLU6WuBQ6b62okjN1On8F4uvVJ6ekr5g2W8gQOWNsBe70l/0roFi jKVH/xQsygeZIv43rxJ5uBzR0seBi7dq8/LksQs58U15Bljhh2tA1r2KtauBT2lswN65 yGP9Pn6/RbvNhy81Dtks0GZXJwkI12xrNcleZqA7fs7MH13ITUITkaDhF5rFNtEwuRFO e/6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="U/9kFJ+D"; 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 y2-20020aa7ccc2000000b005236f5c2d74si821853edt.294.2023.08.25.01.38.52; Fri, 25 Aug 2023 01:39:21 -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="U/9kFJ+D"; 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 S242697AbjHYHCN (ORCPT + 99 others); Fri, 25 Aug 2023 03:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241222AbjHYHCF (ORCPT ); Fri, 25 Aug 2023 03:02:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3A6A199E for ; Fri, 25 Aug 2023 00:02:03 -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 7CD5E63D4D for ; Fri, 25 Aug 2023 07:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78C18C433C9; Fri, 25 Aug 2023 07:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692946922; bh=Rf7azYzBuF/8w9Rf8KpcVWynps2sflW/2Bm2YEq1sPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/9kFJ+DR6ATAbQjeiuz+sfLe9LIhkf5E9HD9toKfDz1tD1l59MH1UqrqcCPqbrav jQBIScMZD4ullWb5m9vRBD1lz9+BSI9750tQDXVvlg69Atb1+qVIS8FwI7MhwFcZ0i O5JOREOGnpDlxQYAfkV6H8N2qtaErIy/9RWCXSI0cn/+gCkLSXlpdx3K6eDkNWJvkL 8RTDCPDa9e9wWktwAfxicKLFpiYXED7b+hYj7lebCD5h6VFawsJzVGAny6SdOc1VWt cp8/nJJe9l5ta33spM/vTmkHwe5K5kvnBBIXx12tFPHsXERpdQ+lwW0k7soMZ1r/ck NnqFNC/XlR2NA== 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/23] x86/srso: Fix srso_show_state() side effect Date: Fri, 25 Aug 2023 00:01:32 -0700 Message-ID: <40b2e6af3a94d2c6eb9a3afaa63f34ee910a17d0.1692919072.git.jpoimboe@kernel.org> 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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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") Reviewed-by: Nikolay Borisov 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