From patchwork Sat Sep 23 12:20:05 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: 144037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp482796vqu; Sat, 23 Sep 2023 21:00:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDdVvSOaoxmnBfuog30YGYKosR+HQfAJFXhsyHg0UCs7auN782mcHDW7TQ0+c9DOIESI5k X-Received: by 2002:a05:6358:7249:b0:134:c37f:4b64 with SMTP id i9-20020a056358724900b00134c37f4b64mr4818476rwa.30.1695528041785; Sat, 23 Sep 2023 21:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695528041; cv=none; d=google.com; s=arc-20160816; b=0YXw9zxs59uBGpINixcAuk8Naiz1t9KHbJUhGJs+GRYyQ/mfmyXVOL+IOlk9hrqgTK 19yF83Uo0UuVs2OY3rJbC+9EpOzwVwxgB50XioDu1k5MhCXWsSmJsQduS23Rs1McFd3R t9cpkrKf72YpAl+eooiZvJ6uX+bS98iXd4xAhEYbfqFdDvvIzPI4PxlLyG8uFXwG2K1S hruhhoc/0oU2sLAxyppFbYMvF121gKvoktgQYjYYIQZmWkGbICQFIwBF/QqUYYqWytvA 9/VYgl+JQ1FZT6lKTZXMbSQ4IFFC7OXHYRxzjTKHEQ1mtrcmOexE6Nzhw4zZMKuSc84U 8fJw== 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=NENjzP+eBj6UdB/lJW3++97qln5t+dpk0N772fLPp0o=; fh=TJa98jjcJcAUyvo2yQiOqi+wukdLlQU80th5XskGe8U=; b=vKsMJ1xH60EGlRSG0pemvt6FAJMXBV9XVoq50m4KxqOMm2b2sehzJRnwWM4AbC2dQp bThl0yfbr4bJYCqnBpJKLf/fsaOGFzWT17E7BZ55iyOlVNO9T2c9fn6I3kUoW6mfN8Th mG144qZbMMEhA8CBiT1qFvUxKRizA80Dyw0lHcDoLtQ6D3qhPelDV3La1J12tqI/Ahd9 aLJx/1dhC6cHZJRTkDGpVXqvvlYju+GgkX0rc1cHB4jHj5HzRYUEA8jI79HTwFEFUkYK pge/ByLLb+jtt8Ml7eDBu3KJl84bjSrGdnAmO2a9BrqTFrpGPLr+3/qpn+mPlf10ZD1F OFFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=skAxN6TN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=aHU32cr5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id d11-20020a170903230b00b001c1f373ea07si7978717plh.351.2023.09.23.21.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 21:00:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=skAxN6TN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=aHU32cr5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 4043C823D051; Sat, 23 Sep 2023 05:20:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231617AbjIWMUR (ORCPT + 29 others); Sat, 23 Sep 2023 08:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231592AbjIWMUP (ORCPT ); Sat, 23 Sep 2023 08:20:15 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D66D619C; Sat, 23 Sep 2023 05:20:08 -0700 (PDT) Date: Sat, 23 Sep 2023 12:20:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695471606; 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=NENjzP+eBj6UdB/lJW3++97qln5t+dpk0N772fLPp0o=; b=skAxN6TNwGbV/okmc7uPBFfWowfrfWQROOKRhvBcjUC+kgYdRpfXTPZhjGLQWFAzRe/a3W XMwkvTYsi/49DLF6btAOK5Cr4OQ6rwOrlPWem1FTY2QA9cFFnOgDfxOqpgW4ar6Zi18eFl G6GXzg/yIz30ULOtJ0K1/PHtm1ZiU4o9cJl01kwT48XUJYyHdVZ5+IH1vfOTCMmSvMrFW0 KM7KVspfUsg7YavBwk6N5/9+faH2looE8v0BE4y7ssdZPa2CPUhll8T71FOCehYZ4pFfto OQoNUJsBdbFqQWWXmXEu6+35TE3nv8UPo3dssuBF7GBO7eeJ745Zq5NCFaTuvA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695471606; 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=NENjzP+eBj6UdB/lJW3++97qln5t+dpk0N772fLPp0o=; b=aHU32cr5T0dKIhy15Jas4QDFB5ooj4plnIPAwBpp1KdcZAp5jCjwMBOxrDz+7SV2iB7CXd zSAIr0v46P4AUADg== 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: <169547160551.27769.16786688898657328238.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,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 agentk.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 (agentk.vger.email [0.0.0.0]); Sat, 23 Sep 2023 05:20:21 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777487879235389640 X-GMAIL-MSGID: 1777890011828324678 The following commit has been merged into the x86/bugs branch of tip: Commit-ID: 88494339b5bccf0abea5660228fd066ec2e91dea Gitweb: https://git.kernel.org/tip/88494339b5bccf0abea5660228fd066ec2e91dea Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:05:04 -07:00 Committer: Ingo Molnar CommitterDate: Sat, 23 Sep 2023 14:13:03 +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 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 49f2be7..6376d01 100644 --- a/arch/x86/lib/retpoline.S +++ b/arch/x86/lib/retpoline.S @@ -321,7 +321,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 @@ -348,7 +348,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 */