Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp953732rdb; Fri, 20 Oct 2023 04:38:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnxc+cPvc47DRj2X23IldJfpR5oFG+ODuwvQKysGQU+kb6zAk4Jrw1IzdbKl7Ydqjr+B1T X-Received: by 2002:a05:6a20:2d1e:b0:160:c1b9:a759 with SMTP id g30-20020a056a202d1e00b00160c1b9a759mr1752496pzl.20.1697801888307; Fri, 20 Oct 2023 04:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697801888; cv=none; d=google.com; s=arc-20160816; b=DCaJ7Rn8xHdfMZ8ivA/ZVhuAtG7VCa+oPMAd/B+WyvUNZNDjuZbARiOP/b4bMCSZ1R MM3Lq06jyimMR00qVrCbi0vG40jr9DC+mg328Xne0oOz4tzfRpqehDp/pXBYeTSM1+IJ 99RqVbOUHGwvBfN7pVaWw/AlNyoH84qZYCTuyHjrBnzIrrJiPBplOkMyiAKtwjhcwiLc pvuGVMivPa7+lKpu2f8AmYME1UdDdi9g/O4ctwN7GMgKTuRrGPYZ3rLTcaptCxVeKfyr AA+XwOxOjZk83De94oDJDdUQbdJXjY4j+kIG4K8Ia62au10LHe/BqpG++F7oBniRMIeV UGOA== 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=3N8mxmLa8dOmxbqulhmE5Th6dhPdFQ5ly250T9T4JZk=; fh=TJa98jjcJcAUyvo2yQiOqi+wukdLlQU80th5XskGe8U=; b=h/y9qh3yIIQw0tBobs8fH9PurtG+LL9fqef4VV2gRcFOzxoCkWjyGM6StmzAYmDff+ JTbzOVox2uD1nEn9zWgZH5clO4uRe0HjbfPejOIKp51o2vzi1UGcc6uxuktoZdoWoHXk vhB97im3gLKR/kZLEdi5ww9/Z04yLM8TWwXiGyyZlCZdwcEIRPJ9mbTjrPqqZYSEFuyp oaiuE0u2zpa8Rm7y1Mdmiko6pbN4QSB4Xt+mdylvHe8TIGCdcUGnPm+IPrVSV8WfmOTs qvw3/2aWfwA3ynwrB3xNt26Kpb7e7LZb05VlTF+76Q99c1JmEl2kLtu8F1FuLjKnxClR zkDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mJhqng+t; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id a12-20020a17090a854c00b0027660aac61asi4195067pjw.114.2023.10.20.04.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 04:38:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mJhqng+t; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 19DAE83F69B1; Fri, 20 Oct 2023 04:38:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377215AbjJTLh2 (ORCPT + 99 others); Fri, 20 Oct 2023 07:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377156AbjJTLhU (ORCPT ); Fri, 20 Oct 2023 07:37:20 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FF9D1A8; Fri, 20 Oct 2023 04:37:18 -0700 (PDT) Date: Fri, 20 Oct 2023 11:37:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697801837; 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=3N8mxmLa8dOmxbqulhmE5Th6dhPdFQ5ly250T9T4JZk=; b=mJhqng+tZQ5vWjAq2ftmskPURNmm3qyYljAZuJ1y1N87MPO8rut+TQGV4mEKrBGss3E+2P n+xH4r1/QSLnexgCymPaWFFU3L9rrCCEGLMv6ro8kRmaasmAOGKoLIxoGsbDh2bKeM4eq/ 6AqPL806XZ5S0G1MYrkPMa/+lUHLKUg18zFfH3bJwK9xokzB80QB0coesWV6THMPw6roSf nRwMXu1kiaoywpx9jiiio3CsqymHURF7dD0PQrPe7Ni0YXLgyPqwmFxlZmszAxVglv/T0+ q9xiviNIM5hW31RKyQCiNow4Unwlfa2vLkjkitf2ubTmBKk8UD8E7Cy0lMytSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697801837; 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=3N8mxmLa8dOmxbqulhmE5Th6dhPdFQ5ly250T9T4JZk=; b=6WmsRVHpROrHfzhyc5YkOy882Hczbt0+N9VMlpB5222HRSwcAnTnTE+Qd3OPzGvNEZRdVr daL3rQUWjeKtdUAQ== 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/bugs] x86/calldepth: Rename __x86_return_skl() to call_depth_return_thunk() Cc: Josh Poimboeuf , Ingo Molnar , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <169780183655.3135.5210163814604862919.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 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 morse.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 (morse.vger.email [0.0.0.0]); Fri, 20 Oct 2023 04:38:03 -0700 (PDT) The following commit has been merged into the x86/bugs branch of tip: Commit-ID: 99ee56c7657f939eecc4e8ac96e0aa0cd6ea7cbd Gitweb: https://git.kernel.org/tip/99ee56c7657f939eecc4e8ac96e0aa0cd6ea7cbd Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:05:04 -07:00 Committer: Borislav Petkov (AMD) CommitterDate: Fri, 20 Oct 2023 12:45:48 +02:00 x86/calldepth: Rename __x86_return_skl() to call_depth_return_thunk() For consistency with the other return thunks, rename __x86_return_skl() to call_depth_return_thunk(). Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Signed-off-by: Borislav Petkov (AMD) Acked-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/ae44e9f9976934e3b5b47a458d523ccb15867561.1693889988.git.jpoimboe@kernel.org --- arch/x86/include/asm/nospec-branch.h | 13 ++++--------- arch/x86/kernel/cpu/bugs.c | 3 ++- arch/x86/lib/retpoline.S | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index dcc7847..14cd3cd 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -358,12 +358,7 @@ extern void entry_ibpb(void); extern void (*x86_return_thunk)(void); #ifdef CONFIG_CALL_DEPTH_TRACKING -extern void __x86_return_skl(void); - -static inline void x86_set_skl_return_thunk(void) -{ - x86_return_thunk = &__x86_return_skl; -} +extern void call_depth_return_thunk(void); #define CALL_DEPTH_ACCOUNT \ ALTERNATIVE("", \ @@ -376,12 +371,12 @@ DECLARE_PER_CPU(u64, __x86_ret_count); DECLARE_PER_CPU(u64, __x86_stuffs_count); DECLARE_PER_CPU(u64, __x86_ctxsw_count); #endif -#else -static inline void x86_set_skl_return_thunk(void) {} +#else /* !CONFIG_CALL_DEPTH_TRACKING */ +static inline void call_depth_return_thunk(void) {} #define CALL_DEPTH_ACCOUNT "" -#endif +#endif /* CONFIG_CALL_DEPTH_TRACKING */ #ifdef CONFIG_RETPOLINE diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 9731e81..016a326 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1059,7 +1059,8 @@ do_cmd_auto: case RETBLEED_MITIGATION_STUFF: setup_force_cpu_cap(X86_FEATURE_RETHUNK); setup_force_cpu_cap(X86_FEATURE_CALL_DEPTH); - x86_set_skl_return_thunk(); + + x86_return_thunk = call_depth_return_thunk; break; default: diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S index 415521d..d410aba 100644 --- a/arch/x86/lib/retpoline.S +++ b/arch/x86/lib/retpoline.S @@ -323,7 +323,7 @@ __EXPORT_THUNK(entry_untrain_ret) #ifdef CONFIG_CALL_DEPTH_TRACKING .align 64 -SYM_FUNC_START(__x86_return_skl) +SYM_FUNC_START(call_depth_return_thunk) ANNOTATE_NOENDBR /* * Keep the hotpath in a 16byte I-fetch for the non-debug @@ -350,7 +350,7 @@ SYM_FUNC_START(__x86_return_skl) ANNOTATE_UNRET_SAFE ret int3 -SYM_FUNC_END(__x86_return_skl) +SYM_FUNC_END(call_depth_return_thunk) #endif /* CONFIG_CALL_DEPTH_TRACKING */