Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp1287610rdb; Mon, 21 Aug 2023 03:20:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGr741KpSEuczLN+TKHXRHM3dJZoUt6tUg+Ueafh0cmTASjo6C/96+YEDkdzQr1rn9Mun8f X-Received: by 2002:a17:906:53ca:b0:9a1:7889:c4c4 with SMTP id p10-20020a17090653ca00b009a17889c4c4mr4451044ejo.25.1692613222563; Mon, 21 Aug 2023 03:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692613222; cv=none; d=google.com; s=arc-20160816; b=BF95j42N8wbW/1sHhyLPCfBc2ztshKwB2npjqLdigE9tKjKOu7JnEITnL8eLmHK6fc cLZGeY75XO/Wg6CHbaEj0l0uU370vgaOdjyO/EN5jxiVsoMgSK+ZGltGy7FxngGNugdt JRGkaqtTnFmexVfQuuVC0ph0cZEKYvy889CwkfTDnFpajSzEs24YcfNoQfOwPRQEiY3M yio1N0tchMex3nLlGjhgYo2QsXLzIquEEwpUPdPMbjwz6kXNKyIFt51vrVCOiMPobgq1 u7c7LBZ9qycwikTPKPJjyw+pQGXUR1dxrNvh0yzhBTLgwK2Lo2eqbOXpFahBUMSYGznT VXqA== 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=Q9+zy2SRPuRmibaN2flqwDs7CA6eGS+zSAAhtpT3NZw=; fh=1KVrD/LnRsN9N7k2d12iARV4DA2tVMW012QtKSrD46c=; b=05UJqDQiEsrdheW4dsZuHdc4gLrISgb6mqVnPi24jFE2i3Nv6oiJBPrAV7OO4iYLXa 8t8b++t9Dp6EL8eg4SW8byfCmdTU7+hTSwtU6aCXxk77RWLny0YczU8TaV0hkBZgyBie vKq2h8GP5JnKPltzmiMQbMvkO+A1j7seQ2rqaMl3PtComuQDGjvvnoku2a3clO0+Y3AC zqHGqFjcyRnfq1DNluiYEf0oU+ouIYHRmy7QJhdZoxoqT26r0M/3+StM97yFkNT5wm0U 07fXdM32wHIQZtfrKIWdC2EDJI2zE6kE9FclI8I3MYEfVjWQyGUxxbNhXB9V3lmwKvD4 08Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KFfuS7gl; 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 p15-20020a17090628cf00b0099bca252ee8si5548422ejd.961.2023.08.21.03.19.58; Mon, 21 Aug 2023 03:20:22 -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=KFfuS7gl; 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 S232313AbjHUBTj (ORCPT + 99 others); Sun, 20 Aug 2023 21:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232280AbjHUBTc (ORCPT ); Sun, 20 Aug 2023 21:19:32 -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 CF7BF9C for ; Sun, 20 Aug 2023 18:19:30 -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 AFAA762600 for ; Mon, 21 Aug 2023 01:19:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAC1BC433C8; Mon, 21 Aug 2023 01:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692580770; bh=1JVPtgGBWI8sOMGshKa4etXbpP/NdE2A1szA4ieQYNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFfuS7glWuB7Z2a4DrXLRwBdhw4LYC7XgZB020eMoUN/861t1bqyK8TDkfN4PfKfx 0e3+jDBLlBLZlXKV00lAyvmGJSsyDlV0ix4cm467fYgNWHRwya23LDr56yvEYVJpBS kBAa0OZFOwwDMsoa9eTq9Pc+ErWD+utTnJQ5VfUngbeLk0S+eLucJkKEdjsRUvz7eZ j4zkjZ6tJQAxM7rOLtmTXMwPivQuI6hBBgMoTfzqKsl4CXeys1rUPpcUL5ZQoCsWED n+eorHqQLuSbYXV2IDzPggmRM8i7YBv1PPugTlNR2HlVd+XZSsCexu5fsDfZFAUp/7 rQGyBL+YfS3vQ== 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 05/22] x86/srso: Fix SBPB enablement for mitigations=off Date: Sun, 20 Aug 2023 18:19:02 -0700 Message-ID: <141c92f20ab46cf0c028e86b946134cd702d0ea5.1692580085.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=-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 If the user has requested no mitigations with mitigations=off, use the lighter-weight SBPB instead of IBPB for other mitigations. Note that even with mitigations=off, IBPB/SBPB may still be used for Spectre v2 user <-> user protection. Whether that makes sense is a question for another day. Fixes: fb3bd914b3ec ("x86/srso: Add a Speculative RAS Overflow mitigation") Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/cpu/bugs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 10499bcd4e39..ff5bfe8f0ee9 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -2496,8 +2496,7 @@ static void __init srso_select_mitigation(void) pr_info("%s%s\n", srso_strings[srso_mitigation], (has_microcode ? "" : ", no microcode")); pred_cmd: - if ((boot_cpu_has(X86_FEATURE_SRSO_NO) || srso_cmd == SRSO_CMD_OFF) && - boot_cpu_has(X86_FEATURE_SBPB)) + if (boot_cpu_has(X86_FEATURE_SBPB) && srso_mitigation == SRSO_MITIGATION_NONE) x86_pred_cmd = PRED_CMD_SBPB; } -- 2.41.0