Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5358372rwb; Wed, 9 Aug 2023 02:59:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFiedfFg5ZynvWSLqnpnIPFGEb8p8Z8ttgC07a9WSR8X6QEb422HWeTPtru5RWnoTXt0qtw X-Received: by 2002:a17:90b:4c8d:b0:267:fe44:86c3 with SMTP id my13-20020a17090b4c8d00b00267fe4486c3mr1551722pjb.31.1691575162819; Wed, 09 Aug 2023 02:59:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691575162; cv=pass; d=google.com; s=arc-20160816; b=m99VSzpXLcRckT6cSD+vMZEWzseBp8v9k/uVViZBxsRyqcoNwSsMG23lIWJKyVUTSh ViT/SrVA6qfI65Ym8HZEpv46oL7BZYDWu7tJ/RqGRlWsGrJXrgOp6VPI13zUQ2JO5mea F8iZ17iZDgieIJ4/GEGpo8fYXWWPWKqEbiYVn0jdXY3M/YnWCu1WhDzds0RU6xsYaRyc J8UOwt+JNvL29x14gbaZ2QfNKidJlQyHvkWCBFegu1G1ZhBqu2wvTX+Rjisf12pP4Ceh KkkiKIMRF9Dd7JHyBVlLnz3Hn/yYYKB2AySl1aC7y8XMnm9yywAJgcuBN3UGk63hOLOV g6SA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=iJ7oQNXonMw30eGHqaC2INb8XNISsp59XXbIM4DBlAA=; fh=XYYzNBWHKHja2nRbf0djLGZguhUH3IeYmtTwOEWgCaE=; b=Bu/kX6Ffr0j9IK/4mXu5NqYMY+vvlDAAZyL9YG2D2ubjD6AzuYB2PXjdW3Pzp8hihl prJnavxnvja3f7msTW7znrwNCJgdGE71o/kLetTd+npQ+ic8aZm3o57ITZsFfla2SuII s/vyDOVIkmlYbRA+Gj/OLio3KGp2W8fxMCmv1m5+DbJM8wKWFzYpXZilE3UjCR+cNhLy caqQkXhbFy/SByHe90BHt3GPsc+W3prtAwtxeF/PwHHeWtxWbjN5rYgndV0TFy3VGVZ8 vIBCyChuS+GyxzSvkvSo5wzYtOUj+5axTqnlkDYHpFjqAPc2PjSz/DK1St46oCCOamYX a4WA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=SfRi5nQP; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a17090ab89300b002684a384026si1098395pjr.36.2023.08.09.02.59.10; Wed, 09 Aug 2023 02:59:22 -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=@suse.com header.s=selector1 header.b=SfRi5nQP; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232043AbjHIJb3 (ORCPT + 99 others); Wed, 9 Aug 2023 05:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbjHIJb2 (ORCPT ); Wed, 9 Aug 2023 05:31:28 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0CF51FD7 for ; Wed, 9 Aug 2023 02:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jjAJL33ifBll+4vx42cqS2jJwH0wWtkft5p4vmiQvqHzepSviFm60qQPeiAzUnoMpALQQrJKNEeNj9MmAGc9M4nOvCQ58Qg7LQICKnK0vKPz6FnEckaJd6zj3V+7wpNDoHMbhxWAIOOC+ifvVD1M675ALwagTJsO7Caeky9UxlFI5BZ1XBZRBhgEoMOEwNojlnqtEjPHfqdP2nF+lMoQ7PumFC3wP+azSs+NWfUIz+UMRSbEB5Xu+il/CYo60eybZ9Cm0cfA1SzLyV8TC0/Z542EydOpd88PDOBcdXFMSrcQy4G8doUHFbHMZhxOkcpcz07WhdSoushaGFG1j8wSOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iJ7oQNXonMw30eGHqaC2INb8XNISsp59XXbIM4DBlAA=; b=nG/vpJP9Esg/qbwzSIhoF4dEIBwlV0vvVFAj7slLN7rIFrthFtE8r7VNCth4DA+qEA/LRRungYsUfxNzSMIt5SinuYBQKjp5+JG7TjUeaaoPLjVSpvD+oR1BXiBI7Bx/CcB/6hYAz+rKcQkh+KDVK+MVpuqHd3qNQaeqSENSIpWXpBQUaWSMMRkzZimInn6w4DKYgvkOlRaeVd6Uwjt1AXOtJSaJdBlWUSktI0m5f7HehQybD5b7gh9X26+lki3F3hAcZpHpqCICqczCMrdV7j/FjrXLgL8rJNB6vtBNSXDt4nRYxvdQdRCBbvEFLSD4Tj+jF87J6UlAhb9eDLnByQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iJ7oQNXonMw30eGHqaC2INb8XNISsp59XXbIM4DBlAA=; b=SfRi5nQPJpp6t+EfCdiEK7V74DFx3mrIvS1QnWVAKUfnnvi5pz6j3hAzPdvAWCfWLPj10usew9/c0+GvORsWWyiK/ekPh7gC5f9rWV6/upC3DpU42s2aG+ZNIUo8RHVBFw8Jz2N+CwmgVf336/ael6Gk9mOvSrRY4SEEo+ftYVu9D+qDNuBlTKQFzuVNL24e4I8TlMiZBx7V4vgmMZ1NYa3Pvid1qEbjFDE0kynwCeTZ23RdJgWjUAe+r7ShvDmDI3x10qx5xHlW/gVQfIKuigcS3XHzSASDv9Tyx+vELpyAAUnxwb2BW0bW57QF5uGXF4JDcRMkQKR+upTN0SNs5g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from PA4PR04MB7790.eurprd04.prod.outlook.com (2603:10a6:102:cc::8) by AM8PR04MB7249.eurprd04.prod.outlook.com (2603:10a6:20b:1d0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28; Wed, 9 Aug 2023 09:31:24 +0000 Received: from PA4PR04MB7790.eurprd04.prod.outlook.com ([fe80::274c:c30b:ac8c:2361]) by PA4PR04MB7790.eurprd04.prod.outlook.com ([fe80::274c:c30b:ac8c:2361%2]) with mapi id 15.20.6652.028; Wed, 9 Aug 2023 09:31:24 +0000 Message-ID: <527ecc24-dc4e-2a64-5a66-d7d9cbdd3bb1@suse.com> Date: Wed, 9 Aug 2023 12:31:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [RFC][PATCH 01/17] x86/alternative: Unconditional custom return thunk Content-Language: en-US To: Peter Zijlstra , x86@kernel.org Cc: linux-kernel@vger.kernel.org, David.Kaplan@amd.com, Andrew.Cooper3@citrix.com, jpoimboe@kernel.org, gregkh@linuxfoundation.org References: <20230809071218.000335006@infradead.org> <20230809072200.450404700@infradead.org> From: Nikolay Borisov In-Reply-To: <20230809072200.450404700@infradead.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: VI1PR0102CA0051.eurprd01.prod.exchangelabs.com (2603:10a6:803::28) To PA4PR04MB7790.eurprd04.prod.outlook.com (2603:10a6:102:cc::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4PR04MB7790:EE_|AM8PR04MB7249:EE_ X-MS-Office365-Filtering-Correlation-Id: 1dc9fe44-bd31-4c7e-0b44-08db98bb6647 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cnA2mYagFwoqMDbUaB8NdKZMPn3FCnefvjD65GceAGx86z2ohvumZPkEC+jEFtvok64o7Lgok+YJHteGQVh5Q4TdFAw9Lk0pmxDwM4fuqW0w8Ijg4yT1GLEJO9zcDP5dQ00r2ShYHxtJ9X0Zw36vRkMlm+hMZLR4F+nkSdWwumk/0blpiru0BhdNR6DCc5NFn2Q5fJwWEbWgnhcc+Bza6nV8eC8B6owVVFYB33HNolwy6jJa5VETJV2ttW+TXw6vSbg6zzZfruiYMh9TBHTR0N2nLrVoOG1YAmumBTEsG4Pum+uK8GbqVp4TB1wGF+nGXn9b/V6LUcBf/G9khbZNlYzdhnC/j/pKoi8PfXPcPoTn7/zLsjOHXfLn61z6p3tA8BmKLJP0djmJhu/8/MmusuSv8J8VLv03cIc3FS+Kv8Z8x/PgCqwtwx2iQJafwsSk1aiX4ARvuFXpjkAn/EsThwj9W4qxutDsTzTDIsZn9aOhY7/z4O7kCrYFF1RTvdLweMujVdtw2iFWHUZdsacsNu2p+1sapKKLZp57P7cK3i9NnwjbM3xrP957HfGKBuMN4EI56Le0xJ3ZXy1BLTUCCdcwzvbHf67i+FJdbYihD9WSHKpCC3bNGeJ643mQ6/Om+41nlWwj/JbbjubN97Liqw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR04MB7790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(346002)(376002)(136003)(396003)(186006)(451199021)(1800799006)(6506007)(26005)(31686004)(36756003)(6512007)(6666004)(86362001)(31696002)(6486002)(478600001)(2616005)(83380400001)(41300700001)(66946007)(66476007)(66556008)(316002)(4326008)(5660300002)(8936002)(38100700002)(8676002)(2906002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WDh6amEvSVdnc05jWlhHUjFwUFUyTitaOENRQ044dktFRWRLa0xBdnpFWjU1?= =?utf-8?B?MUNuanFVT2tZdmJodmU2MkNrZzgxR1ovaERvSEFZWGVUQkxBK04xMndUVFpZ?= =?utf-8?B?dHgxbGovUE1UOGYwS2I0bS85TzlBNnRXWnZSUG9pZ3d5bGp5ZnUxVndsdTZN?= =?utf-8?B?QTBvb2ZzUmMvZzRUK3VhQ2FHSkZmajJlV3VSQW1RLy9mYldJQ2V3YWJUaytS?= =?utf-8?B?bGlLU29OTzFpSVFvcUVPL29LeGFNMFhMVzlua1l5ZzhsWWh5Z3pqZHpFOEpp?= =?utf-8?B?UTRHTG8rMVVzZ2JyNUNuMTVQc3lwSzZKWWdGa21EdDNRQnRZTVZMeGZTWDZP?= =?utf-8?B?R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Org: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1dc9fe44-bd31-4c7e-0b44-08db98bb6647 X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB7790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 09:31:24.7773 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VoG9Pe8FqQDyddD4k4+fp0Gnrx7vQp2UtusnsZNS4aPQouJARc33ZEcZ+llucxLVzMp/c0WaYawWMEb960Tmdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7249 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, 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: X-Mailing-List: linux-kernel@vger.kernel.org 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) > --- > 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