Message ID | 20230809072200.450404700@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2645220vqr; Wed, 9 Aug 2023 01:28:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzsRh1I3BopEVsNNhC9DhE5UYBLtH0LFNAStBa1caGFUNNIH5LBJiW30ilz9RU/0UQ1Gvf X-Received: by 2002:a05:6830:1d64:b0:6b7:378d:7daa with SMTP id l4-20020a0568301d6400b006b7378d7daamr2250344oti.4.1691569720537; Wed, 09 Aug 2023 01:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691569720; cv=none; d=google.com; s=arc-20160816; b=T59+6+XVsqC1V8lIpoJw2Z5WTxq7yiVXjSil23Ic+QGg4P03Xv1fkvgL45ikhIrTES dsD/b7/fpZvMilSV1bt4yMEhLsuw5SgwdYYYFnDLYDHxx8Q5VWXB0AVuUybZyuAiKpNn e4e8L+ZLoLznvlXxwmxeNzMms+R/Xu2Hv4wX4kv5B71QspC33Nrbzy7mncmSqMnrJE9P ST8lsEETwwrk7a+RL4BW/ywRajj7dggnrZw8AaH84RaROArajPZauIjAhGGUByL/uB2t OI/9it8qoL1m/SiRXGBsO9UlxtkFB4V6sXmqud7GAaK5qI9fNLY+BaV9vD18wtbJghhb e0Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=zoLAuzkIHX55kt02j2vg7TbXefeLx4iSw6mLX1oYzJs=; fh=o45i9bBrOE/GuAHaEwxsN59PvrZuIOmhioZFWcmA1tw=; b=uTYfvakHCX5BvEJLoMxuOeHQzQefqj7Wj/Pf4efr1QrX2syIvKPRNr1xMG6AqaG6DH VR/G7kVxNTJkO+yj9g3nRS83MEeJg7l62Y+g9e2Enz1A9bgafL3XOy6ZnRdGsrFNQC3b 6t38XeExoCFCIbf39lgW6lyZ8fgGuDLimpbvytlUeNJGghVBypORk5Bttmrp5B7sOwqb 2KVJpkG0FU+aWQNONoft7rtYM3m6vBCspelQd42aShoJZkAyqI9by2K4CAbYUrthLVW3 mR3MQG+OxhqoDMTgo+w7Y3P52bA8CsWUTQ0qil5WJOjL8cLr2iQWI/z1VSWM9xuralfQ mI0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=YZqtjwI+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a63360b000000b005644f8fa12dsi8637916pga.335.2023.08.09.01.28.26; Wed, 09 Aug 2023 01:28:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=YZqtjwI+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231723AbjHIH1W (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Wed, 9 Aug 2023 03:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231638AbjHIH05 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 9 Aug 2023 03:26:57 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5AB91FD0 for <linux-kernel@vger.kernel.org>; Wed, 9 Aug 2023 00:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=zoLAuzkIHX55kt02j2vg7TbXefeLx4iSw6mLX1oYzJs=; b=YZqtjwI+Hd9FoxVBeKsgNySyrk JY490/rHu/X/6Afnwrs9mppQHBC7PW08qJTWbNWwyOY9dNn5C4W5T6vPyjtsFFpN70LLUJ4ch4tZp m0M3xOFXXpiWNYOxCt92fWSWt1koaziy8eHmNUISBXezJISLcmt80jRVV8qbRk1C9nKrIcty9j+Gv S9BZb5WGSjzgA0ETeGL0T+Xecc2G9fohhTFrry9k0ugPotFg2kUkcRyBkTBcA0WJCWkf3+NbWyJJy H3+b5gQAQ6UZ0LjK1DyyXjQohLMUdn31C7FZQER8c/SixE0ZiyYoj/XJgiUbWYdec8bH59nWT5GXQ b20f6u9A==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qTdae-005TeH-2m; Wed, 09 Aug 2023 07:26:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5A91E300346; Wed, 9 Aug 2023 09:26:44 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 3DD012C865678; Wed, 9 Aug 2023 09:26:44 +0200 (CEST) Message-ID: <20230809072200.450404700@infradead.org> User-Agent: quilt/0.66 Date: Wed, 09 Aug 2023 09:12:19 +0200 From: Peter Zijlstra <peterz@infradead.org> To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, David.Kaplan@amd.com, Andrew.Cooper3@citrix.com, jpoimboe@kernel.org, gregkh@linuxfoundation.org Subject: [RFC][PATCH 01/17] x86/alternative: Unconditional custom return thunk References: <20230809071218.000335006@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773739411253420546 X-GMAIL-MSGID: 1773739411253420546 |
Series |
Fix up the recent SRSO patches
|
|
Commit Message
Peter Zijlstra
Aug. 9, 2023, 7:12 a.m. UTC
There is infrastructure to rewrite return thunks to point to any
random thunk one desires, unwrap that from CALL_THUNKS, which up to
now was the sole user of that.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/include/asm/nospec-branch.h | 4 ----
arch/x86/kernel/alternative.c | 2 --
2 files changed, 6 deletions(-)
Comments
On 9.08.23 г. 10:12 ч., Peter Zijlstra wrote: > There is infrastructure to rewrite return thunks to point to any > random thunk one desires, unwrap that from CALL_THUNKS, which up to > now was the sole user of that. > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > --- > arch/x86/include/asm/nospec-branch.h | 4 ---- > arch/x86/kernel/alternative.c | 2 -- > 2 files changed, 6 deletions(-) > > --- a/arch/x86/include/asm/nospec-branch.h > +++ b/arch/x86/include/asm/nospec-branch.h > @@ -347,11 +347,7 @@ extern void srso_untrain_ret(void); > extern void srso_untrain_ret_alias(void); > extern void entry_ibpb(void); > > -#ifdef CONFIG_CALL_THUNKS > extern void (*x86_return_thunk)(void); > -#else > -#define x86_return_thunk (&__x86_return_thunk) > -#endif > > #ifdef CONFIG_CALL_DEPTH_TRACKING > extern void __x86_return_skl(void); > --- a/arch/x86/kernel/alternative.c > +++ b/arch/x86/kernel/alternative.c > @@ -698,9 +698,7 @@ void __init_or_module noinline apply_ret > > #ifdef CONFIG_RETHUNK > > -#ifdef CONFIG_CALL_THUNKS > void (*x86_return_thunk)(void) __ro_after_init = &__x86_return_thunk; > -#endif > > /* > * Rewrite the compiler generated return thunk tail-calls. > > Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
On Wed, Aug 09, 2023 at 09:12:19AM +0200, Peter Zijlstra wrote: Please add a verb to the subject: "Make the custom return thunk unconditional" or so. > There is infrastructure to rewrite return thunks to point to any > random thunk one desires, unwrap that from CALL_THUNKS, which up to > now was the sole user of that. And yes, provided we can do the thing in the next patch which makes sense to me, ack.
--- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -347,11 +347,7 @@ extern void srso_untrain_ret(void); extern void srso_untrain_ret_alias(void); extern void entry_ibpb(void); -#ifdef CONFIG_CALL_THUNKS extern void (*x86_return_thunk)(void); -#else -#define x86_return_thunk (&__x86_return_thunk) -#endif #ifdef CONFIG_CALL_DEPTH_TRACKING extern void __x86_return_skl(void); --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -698,9 +698,7 @@ void __init_or_module noinline apply_ret #ifdef CONFIG_RETHUNK -#ifdef CONFIG_CALL_THUNKS void (*x86_return_thunk)(void) __ro_after_init = &__x86_return_thunk; -#endif /* * Rewrite the compiler generated return thunk tail-calls.