Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp535070rdb; Thu, 19 Oct 2023 11:12:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEuN98ZlaoTpLG/FL7zrhwSTowzudTVHhzTwX3RXp0aMTpYtAFPeOI08XHwjmXKtUTRjgK7 X-Received: by 2002:a05:6870:1287:b0:1ea:c8a9:fce5 with SMTP id 7-20020a056870128700b001eac8a9fce5mr2723409oal.38.1697739156010; Thu, 19 Oct 2023 11:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697739155; cv=none; d=google.com; s=arc-20160816; b=eQ/qUh6vHTfIU2UL7ZOhuAEVL2ECBvYnsaTzSj6xGZEXLv8kTpFwiNsnNvRRi7gGFp 1mgdJ0/rR+QLfGtJrliZ6oX5y5cJNXLgzj3fMY8ZjSUl3ACd8XGHtcWVa6HDjY32D8NF cwKlMOijRBi/r4Tco6zgqC42YVV7P7/Ci/u/hO7p1/q0lHhipSAONrfOItD24WaPplCg E5s+Zxx3Qd98VtsDNOZs3RkBp2NKnULNnNMvjdopjFRLlJXx2BQIDXMflNuNgryzJCuN TxJ3lDy9CpPIQWvAfJeJZVkYGIZ241rWjVOSsrS0JXs67t/DqlEZNxmmjUsicPxxjwAr ufIQ== 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=KzUTZ2tVIcLFVmnHYkHPd+CZ+4cvt+7WkUIii7z93Do=; fh=T/Na3StdsDt/Vl3W5ovSX6FCLua67DwAek6VvvDgcow=; b=ZNaS9xtwAmLYu04t3lCAiadiZ+Ibpa3jyluVD8ATSTSkXWVwYNWCWajx35zjErVIPv OvgWF1Ywh2/aqAHzhrVv+FVIjPfueoTO2kImzlFVR/Ad4Icto6b0iSnKlMfkcAuT1UWO fsHmZIYm3ttP7pKMKDCF812wI+4w4W4wUI8w7pN7z7zYsx0RJCl7OFVK3eW1f4M8miqw W5or7/ec44skCcO6iRJY29Oo7UHp83D+cQxDF/TATmfvPbBkOX6EuzAnHlo3XaTvmXqY g4kfafqKmH7Wj5njokTiNsohKzUm4NXLbAxaddlWoE9m1GOvZuI/D2tofCVCIxPAxwt6 EPwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t15-20020a63dd0f000000b005ab6142f1b7si104509pgg.785.2023.10.19.11.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 11:12:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D50F0827007E; Thu, 19 Oct 2023 11:12:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346375AbjJSSM0 (ORCPT + 99 others); Thu, 19 Oct 2023 14:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346346AbjJSSMZ (ORCPT ); Thu, 19 Oct 2023 14:12:25 -0400 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19E9121 for ; Thu, 19 Oct 2023 11:12:23 -0700 (PDT) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-9ae2cc4d17eso1332870966b.1 for ; Thu, 19 Oct 2023 11:12:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697739142; x=1698343942; 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=KzUTZ2tVIcLFVmnHYkHPd+CZ+4cvt+7WkUIii7z93Do=; b=u3dkRZQKwvIunbH7GFtq5EvNFLy9ycDhM9+M0OJjTdb1IhdyEwAv85bQrtFbhyCpuN H8ZJZ4Lrc2uWK5EmfWlFORSNxgxrAhZo1X/cPpFZXy1atx0CVtxYxvDlWsSDxG/pR8fU nROURLL+WsJhMHDyVqMk+d28fh6JD4PCqroH4lMcxASqjjw0OtjvVkKgL3utjBGGs4fS YROmHvrFBEy6o4fzKAopUhjZA410CDTE2To0SrpLz8xMlSsu9X705dGDyZOGvL5VyzCl 1dm75k6bUY3lax6GwK5BB4UwRbKedYH3oQa493tu6c5E+NGBQOPSzbc8L2p10MZX5UiF fj/w== X-Gm-Message-State: AOJu0YyAqxaPExopZPL8a369g8j7HSb2o43c+oV4GsJpUcUhxAX8ni3h cEppB1KrTfljCcaPUQgBV50= X-Received: by 2002:a17:906:6a1b:b0:9ae:5fe1:ef01 with SMTP id qw27-20020a1709066a1b00b009ae5fe1ef01mr2065867ejc.37.1697739142233; Thu, 19 Oct 2023 11:12:22 -0700 (PDT) Received: from localhost (fwdproxy-cln-022.fbsv.net. [2a03:2880:31ff:16::face:b00c]) by smtp.gmail.com with ESMTPSA id u13-20020a170906408d00b009932337747esm3922300ejj.86.2023.10.19.11.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 11:12:21 -0700 (PDT) From: Breno Leitao To: jpoimboe@kernel.org, mingo@redhat.com, tglx@linutronix.de, bp@alien8.de, Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Pawan Gupta Cc: leit@meta.com, linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [PATCH v5 02/12] x86/bugs: Rename CPU_IBPB_ENTRY to MITIGATION_IBPB_ENTRY Date: Thu, 19 Oct 2023 11:11:48 -0700 Message-Id: <20231019181158.1982205-3-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019181158.1982205-1-leitao@debian.org> References: <20231019181158.1982205-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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 11:12:35 -0700 (PDT) CPU mitigations config entries are inconsistent, and names are hard to related. There are concrete benefits for both users and developers of having all the mitigation config options living in the same config namespace. The mitigation options should have consistency and start with MITIGATION. Rename the Kconfig entry from CPU_IBPB_ENTRY to MITIGATION_IBPB_ENTRY. Suggested-by: Josh Poimboeuf Signed-off-by: Breno Leitao --- arch/x86/Kconfig | 2 +- arch/x86/include/asm/nospec-branch.h | 2 +- arch/x86/kernel/cpu/bugs.c | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d0a9f5a5c8a4..b8965bb7443b 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2533,7 +2533,7 @@ config CALL_THUNKS_DEBUG Only enable this when you are debugging call thunks as this creates a noticeable runtime overhead. If unsure say N. -config CPU_IBPB_ENTRY +config MITIGATION_IBPB_ENTRY bool "Enable IBPB on kernel entry" depends on CPU_SUP_AMD && X86_64 default y diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index f93e9b96927a..0676b077207c 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -289,7 +289,7 @@ * where we have a stack but before any RET instruction. */ .macro __UNTRAIN_RET ibpb_feature, call_depth_insns -#if defined(CONFIG_RETHUNK) || defined(CONFIG_CPU_IBPB_ENTRY) +#if defined(CONFIG_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY) VALIDATE_UNRET_END ALTERNATIVE_3 "", \ CALL_UNTRAIN_RET, X86_FEATURE_UNRET, \ diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 3c7e27b58f0e..1de4791091ca 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -994,10 +994,10 @@ static void __init retbleed_select_mitigation(void) if (!boot_cpu_has(X86_FEATURE_IBPB)) { pr_err("WARNING: CPU does not support IBPB.\n"); goto do_cmd_auto; - } else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY)) { + } else if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) { retbleed_mitigation = RETBLEED_MITIGATION_IBPB; } else { - pr_err("WARNING: kernel not compiled with CPU_IBPB_ENTRY.\n"); + pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n"); goto do_cmd_auto; } break; @@ -1023,7 +1023,8 @@ static void __init retbleed_select_mitigation(void) boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { if (IS_ENABLED(CONFIG_CPU_UNRET_ENTRY)) retbleed_mitigation = RETBLEED_MITIGATION_UNRET; - else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY) && boot_cpu_has(X86_FEATURE_IBPB)) + else if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY) && + boot_cpu_has(X86_FEATURE_IBPB)) retbleed_mitigation = RETBLEED_MITIGATION_IBPB; } @@ -2482,13 +2483,13 @@ static void __init srso_select_mitigation(void) break; case SRSO_CMD_IBPB: - if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY)) { + if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) { if (has_microcode) { setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB); srso_mitigation = SRSO_MITIGATION_IBPB; } } else { - pr_err("WARNING: kernel not compiled with CPU_IBPB_ENTRY.\n"); + pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n"); } break; -- 2.34.1