From patchwork Fri Oct 20 11:37:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 156023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp990401vqb; Fri, 20 Oct 2023 04:37:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnbDmn6noOdbwMKrCA/YjdJhOYNfi8WtSfnho6GD2ozgEQRhtE7i8fGcodhUUiWsmaEBse X-Received: by 2002:a17:902:ed55:b0:1c5:b4a1:ff6 with SMTP id y21-20020a170902ed5500b001c5b4a10ff6mr1565826plb.45.1697801873073; Fri, 20 Oct 2023 04:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697801873; cv=none; d=google.com; s=arc-20160816; b=cSPS0yIDvMFOtJP4FJ82MSSTTYGrcAOvtkGoUW2qsTLEP4KTak7Ar6n8qdRE51YhzH jjc8SFODo9L6PtGtmp4ur3KyX3h0TTKGh2tOWLcD7dWukhGB5OZPdQ86lgRTM0v+Bb25 +n+cAQyjzazemNmE8SpObHpvBEDqP3Pr2jqQ77PYl+UIFUfVLdpn8GSaMSZPt1vL2U3+ M1WoDBvUgy2jSCHSBOOUlm3m6gfNBBxADAVcAYxDv93hkJKPfLmhOfD38cnrlx9j8ahF eXIUsDKglwoVsySIZJxvE1KxGVpi0UCke6is5296TlcZqjBTDWXqzgidY1kvi6uvRt5j pqPw== 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 Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id k13-20020a170902c40d00b001c9e422c587si1725711plk.368.2023.10.20.04.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 04:37:53 -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 C70C383F69AF; Fri, 20 Oct 2023 04:37:47 -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 S1377110AbjJTLh2 (ORCPT + 25 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 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:37:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777487879235389640 X-GMAIL-MSGID: 1780274297000856863 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 */