From patchwork Tue Sep 19 09:53:08 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: 142007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3558711vqi; Tue, 19 Sep 2023 10:28:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAdJYZRbejLCkvS6wOnxSAtJrHDcmiIi50z7i5AQPrQvmxudz3Ubj3+mJaUDDfMpaOIfJq X-Received: by 2002:a17:90a:17c3:b0:271:9a75:6cda with SMTP id q61-20020a17090a17c300b002719a756cdamr346341pja.14.1695144538583; Tue, 19 Sep 2023 10:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695144538; cv=none; d=google.com; s=arc-20160816; b=jU90a4OhHEU3TjTf4pQ6gKp1vKIfBt4WlKEo8m2Na6HEWVLiAUTLcPeYBZskx2w7UD LBU+aO8KIb8wTm76Lrbprgd/qFsNrvgzhhuF4e3KFq7ORYLNVpTf3M/iKSLSyVUcp/xW 24iFW1t9BnRTJpr6bve3GEMf8fcDQ5ozrHZrrVtuiBINhj0/yM0t4GP2d7fLnjyyWLQ0 I99DsfqrndAANKaDmLma/8XyOgdrExvLR+/vhhNjf+IIztYCj/aH1BTkdQR0b+MwMQNH 9hN9uanODbZEfL6NFHBDkJUeujPKdJPdvsH9kcV1waCbSKf12z5wuXjvdMv7FxYc3cjd QREA== 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=YpmnxUA3J/kZvK2oFq9pHqu4fm4lfN0LSPO3hLVJ34c=; fh=TJa98jjcJcAUyvo2yQiOqi+wukdLlQU80th5XskGe8U=; b=XxXsNeI9dPnYAgzCvdVY72euNvFeVuI+byZ3jZbN+c3vlBnoA2l0Jk2hsWHfASppW7 qbCwH8BK4jKvej/32TGT9EK+Ddfgr8IaVt60RRAHA+RlZNgpBNrTpOCFgt3ACV3U3RGL LxpJUicm1osFmkNQ1kDqcct4/vypCqKKtjsY0iXONui68lOaypHE2Y2XoJA6P8cjE3T6 n9HvploWa2ARSiZqN9hKVP+iBQ8pWw4rfYqBID9mWfsExxk0fQ/1WkuCzXlE+2CforrK l0ADZowJl87uqPmWbfv0kohlCDBiFb7jEWQ/euUQngJ1ECfs3j/8OJHBrjfG6+aLhkzU VpRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ri5z4gfN; 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 o13-20020a17090ac70d00b0026b49dac834si4196003pjt.34.2023.09.19.10.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 10:28:58 -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=ri5z4gfN; 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 413F7801F3F7; Tue, 19 Sep 2023 02:53:45 -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 S231651AbjISJxd (ORCPT + 26 others); Tue, 19 Sep 2023 05:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231795AbjISJxR (ORCPT ); Tue, 19 Sep 2023 05:53:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B77771A4; Tue, 19 Sep 2023 02:53:10 -0700 (PDT) Date: Tue, 19 Sep 2023 09:53:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695117188; 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=YpmnxUA3J/kZvK2oFq9pHqu4fm4lfN0LSPO3hLVJ34c=; b=ri5z4gfN9a6B/MbG8Jf/6b7rqHiD/H9w76+5TB+J9bdSzkBGBZ7DN2gtK9nPaq21idUAeZ TWvQqXATX1IKCGW7CqK89HsEndwopZ5VZCt4weirRKtdIC/KHBb4XnqWkriavzX1p64eGi 3+1lONKanMf/Xxf/bwTMoj78cebHL1kPjjs+PHgmUrM7FyfPp9y3CtMYEmGfSCEXO/2msW MDokt6fw4ld4uVez2PBCk0UX7zlybEVhczw3YaLESwx6BNrW/1eCoVj5odW4gzIaeDtgGE EiZs8O3UmkD4gG7gb29c3zkmcDT9YkcGw+tes1gEiKKz4GvFkMeDDVmhVefprg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695117188; 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=YpmnxUA3J/kZvK2oFq9pHqu4fm4lfN0LSPO3hLVJ34c=; b=oJ3XJT6G4d2WxqCoIKGciLOPEY8dI/ZjAG+rSSPxKKEZSWdJVMaZRVHPHcp0dr6Q8MWO9T ekAG9zeESlhptVDw== 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: <169511718822.27769.15576635469531405035.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.9 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]); Tue, 19 Sep 2023 02:53:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777487879235389640 X-GMAIL-MSGID: 1777487879235389640 The following commit has been merged into the x86/bugs branch of tip: Commit-ID: 01e1e86d8d206c2e34e66ff03d0bd5ce49675265 Gitweb: https://git.kernel.org/tip/01e1e86d8d206c2e34e66ff03d0bd5ce49675265 Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:05:04 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 19 Sep 2023 11:42: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 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 */