From patchwork Tue Oct 10 17:10:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kaplan, David" X-Patchwork-Id: 150880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp11709vqb; Tue, 10 Oct 2023 10:11:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEArky32Qs+TakEOo8HztY+jzgF5aQ3V6WHh31Pt9Ms7i85Bgfs7gDVni79s61meh7Ts1Dq X-Received: by 2002:a17:902:6941:b0:1bb:b855:db3c with SMTP id k1-20020a170902694100b001bbb855db3cmr12523056plt.41.1696957867170; Tue, 10 Oct 2023 10:11:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696957867; cv=pass; d=google.com; s=arc-20160816; b=y4WIfNkGpQbQdVJfquExURUDoGFZlB01L+k820bw7SJNn1XmrbpzC6/Q/YZFiYjN8f 9jxZuiBiGqxGNazuctOJzATQnVGHNilgpGKQRFkg1jpVjlk/xueC3HIe1y2pB4NTiEVl UHTpr7jeIs4mnqcJ7vlcjegq45PrERQlPHMdhvp7J4+Im6Jtx/TLrIfndTAqJOy2e1Lj l4Escpf5UWYNVz7E4kuHwfcbjVCAbBS+m4xD2OlGP2WK97e8dqvdPcFH5FpTW7/aj1sw DnZCAZ6uoWYSVB3+8NYv+8kE7418YNinzQ7LRcpYOP4t85H4wa9O89d42OY1xkSDtQvK 9HRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=P68wo6zt5TAxWt+pCXOd683FhgHEfFqkuoHeFXwxk6A=; fh=NF2z8D1okmMlEcQoynZki8Zq0uYBvWjLzLW7FFZFR0g=; b=mJ3HwlyrBoOeHvS149AIVCEVBHY8i8EwQVetMZQDrLTzkItHqoNJgwTzerLrf63yr0 mvVdyuVQMjuINHOO05PJTbY3l9Knx7Bz5ZtsQL+c87r+/I2QQDAvopF9y9O4Mb1sT4o+ LkwgAq1X53bZxkNY0kejYQa+gSIIYlADC9PZLZZbggzxJ2CpEFIb2uqyr5bvogyXkk3D PTsd1Kv17wyy7kroH1dBLpkJM0/Xdc/S6GGMsxYDkQ46/N2WvihwVz0bTq64wB/kCP3E /zxIPeqKujmeCcL/4+5c4Uh/Z/Kva9IVdAycJmST7oYHuRsFclJG/7nhUigSOR6jVMU8 D9eA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=g0Cq0kUF; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id m10-20020a170902db0a00b001c7345bc007si13128919plx.486.2023.10.10.10.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 10:11:07 -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=@amd.com header.s=selector1 header.b=g0Cq0kUF; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0D4BE809079A; Tue, 10 Oct 2023 10:11:03 -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 S233555AbjJJRKq (ORCPT + 20 others); Tue, 10 Oct 2023 13:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232908AbjJJRKo (ORCPT ); Tue, 10 Oct 2023 13:10:44 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2085.outbound.protection.outlook.com [40.107.93.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A8D0B7 for ; Tue, 10 Oct 2023 10:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DmsKnOT1U73z65cDB835xfc/Z2MCQcreQ3llaqdsVkaBax5yGQDJxKJ4oMDyX84UM0IMh8dyrMUlKSOPMrTf8EpCdAxhyxVuuEi6/iNSloGj+R/tXOC9B9Mzk3iuUJCv3OhYncCdqrQ49Kfvqu0YdcrqNVxi/hA/evJ9QGOMldkUPvawT4Fu43Mpd/hVLGfZZ4495Y0bbQZsXLrzLwA2TTXPOullCAnTYKCde7gl35DDxRNaYgQ4rV1emj+os1RKfAFOs+eSyBoWHQD1CY4EEIopREiAm6oXlvSrMsaB8cGsGLY9OHyePyFMWDso8+wreBgbrHnbp5/DjpWiuzA9Cw== 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=P68wo6zt5TAxWt+pCXOd683FhgHEfFqkuoHeFXwxk6A=; b=Y+W+YEWNoRyX3fkFFhLcEUi2lXUbJQrBgFeteHs+P9dQFkum0hSLWVbfZhvTqdG2uyhoOdFVF6JwVpEdWLYeOzf/gI8qppKvBI1IiE0KtbiRWk+ItnsAreNinXFJzhi1tnLJr+5bxppAXPoJvoadCbyXXoDNoIKuCJJKugmydOfMDijBmHc9pYtzw2zXVPna5+lkjQrT5wMf/P73YeXzQMfambZvdteoS/y16VevKOr59Lv8qTSvkuQODTF3vvo1dhHmKPLKMU28bHUicZxTcORJMmEMThkFpVT53FrddrmqpeI04qpPG67mc6TwSzacHcd+HjJ/2ZLZoGk7X6vD6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P68wo6zt5TAxWt+pCXOd683FhgHEfFqkuoHeFXwxk6A=; b=g0Cq0kUFhfb5PjoEruMh/Tl9qu62SSCOM/+3Ryzby7K/MEamfFVjZL/NLCRY7D3xIUl0KI6d/TK1Wih8cIyDrALpfLlFBDbifEpcFE8R18/CViQ0+cA8F6zIzZzsqtiRikBSvxAocDvYeI1Mgn/wp5alFbN+anJ8YwsNNwHZQa0= Received: from MW4P220CA0030.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::35) by IA0PR12MB8352.namprd12.prod.outlook.com (2603:10b6:208:3dd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.29; Tue, 10 Oct 2023 17:10:38 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:115:cafe::75) by MW4P220CA0030.outlook.office365.com (2603:10b6:303:115::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 17:10:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.6 via Frontend Transport; Tue, 10 Oct 2023 17:10:38 +0000 Received: from tiny.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 10 Oct 2023 12:10:37 -0500 From: David Kaplan To: , CC: , Josh Poimboeuf Subject: [PATCH 1/3] Revert "x86/retpoline: Remove .text..__x86.return_thunk section" Date: Tue, 10 Oct 2023 12:10:18 -0500 Message-ID: <20231010171020.462211-2-david.kaplan@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231010171020.462211-1-david.kaplan@amd.com> References: <20231010171020.462211-1-david.kaplan@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|IA0PR12MB8352:EE_ X-MS-Office365-Filtering-Correlation-Id: 15836d23-8365-4fc4-8e0c-08dbc9b3d342 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PKRQk3PdZv16PM4zdk3dPbXz+FbBoLEDjWH0rI1t7SyiXLn/jOPtwxzgcmvvZUwITpCAwsqWi3Eevo+3ajjR3lwnPRr7OYH3TVQh/Kfw8iAUmzzEhnsXSEBTZy3q57xgMDlxQ6geLdLXbAWqdWHUeSJYllrbhp6zpZSscQKFPk+Q9MaeAgtXeLGdlRgiFDwxCB2SsUNUY8v84aobufANg5rIZAFMwEBb7yeAJm9DdqoLZweRgKtxKZ3rVaSTH2pFZVh/3eK/IO2zGpW/Ujn+lgi1WWViH2Izlvmp+jjX6IxzVFux8eo/M2Auu7aWkwg0ilj/wzQfL7UO5mwcXgUBd1998Loek7BwQTHDtWRx23zjuJ6L7foPpCypPxyzP3kAtgNIgkA+leKV+Ge3RTLA9QSJWTxj74yD2bmI+a2aE1t3t3F6d66zpWIvo3JR2rfjnEbe8pH2rnLLoauOKF9Mx8DRLebFTEjTxI6kTOMm6A5Kxgj17FBj0GMDGtXnr4Jcytcvc6YOrltuhnnnEoslL4FqBLiU/1CbmqYv93Y/KdBcYeEGiNIARfw52vUdS8dz84dJ+uPx5SG1lB+Rnlpc3BAUDAv6V9EIgNUAYtMS1Xb0KKDMo+XrJIsNq6itxqLS1a/efv9HXVgcMdPFN1czgF+PQn6tQO2krWpNwCcS2uMoVXKNNQ00kkxAdNaH0cnxNPXINN0bIbk9f1XxNChIKS9xuqyleKmq0oaJ81flv3Lwh58tyNeLXqQEBhaj6z8ReKc6aY5ImOBW5u/7ML6dxCgaMEdCYOWXp1VWpISKT0Q= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(396003)(346002)(136003)(39860400002)(230922051799003)(451199024)(1800799009)(82310400011)(64100799003)(186009)(36840700001)(46966006)(40470700004)(8936002)(82740400003)(40480700001)(478600001)(4326008)(8676002)(44832011)(7696005)(47076005)(40460700003)(36756003)(36860700001)(316002)(5660300002)(54906003)(110136005)(70206006)(41300700001)(70586007)(356005)(6666004)(1076003)(2616005)(336012)(426003)(2906002)(26005)(83380400001)(81166007)(86362001)(16526019)(142923001)(101420200003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 17:10:38.1396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15836d23-8365-4fc4-8e0c-08dbc9b3d342 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8352 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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]); Tue, 10 Oct 2023 10:11:03 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779389292753251999 X-GMAIL-MSGID: 1779389292753251999 This reverts commit e92626af3234708fe30f53b269d210d202b95206. This commit broke patching of the return thunk jmp in the retpoline sequence. Before (broken sequence): objdump -d -r arch/x86/lib/retpoline.o: 0000000000000000 <__x86_indirect_thunk_array>: ... a: e9 d1 02 00 00 jmpq 2e0 <__x86_return_thunk> live disassembly at runtime: 0xffffffff81d12a8a <+10>: jmpq 0xffffffff81d12d60 <__x86_return_thunk> This jmp to the default return thunk should not happen after alternatives patching. After reverting this: objdump -d -r arch/x86/lib/retpoline.o: 0000000000000000 <__x86_indirect_thunk_array>: ... a: e9 00 00 00 00 jmpq f <__x86_indirect_thunk_array+0xf> b: R_X86_64_PLT32 __x86_return_thunk-0x4 live disassembly at runtime: 0xffffffff81d12a8a <+10>: jmpq 0xffffffff81f0410b This is correct as the jmp is written to the correct return sequence. objtool (add_jump_destinations()) only recognizes return thunk jmps that have relocation entries, which will not occur if the return thunk is in the same section as the indirect thunks. Signed-off-by: David Kaplan Cc: Josh Poimboeuf Reported-by: David Kaplan Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/vmlinux.lds.S | 3 +++ arch/x86/lib/retpoline.S | 2 ++ 2 files changed, 5 insertions(+) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 9cdb1a7332c4..54a5596adaa6 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -132,7 +132,10 @@ SECTIONS LOCK_TEXT KPROBES_TEXT SOFTIRQENTRY_TEXT +#ifdef CONFIG_RETPOLINE *(.text..__x86.indirect_thunk) + *(.text..__x86.return_thunk) +#endif STATIC_CALL_TEXT ALIGN_ENTRY_TEXT_BEGIN diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S index db813113e637..3da768a71cf9 100644 --- a/arch/x86/lib/retpoline.S +++ b/arch/x86/lib/retpoline.S @@ -129,6 +129,8 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array) #ifdef CONFIG_RETHUNK + .section .text..__x86.return_thunk + #ifdef CONFIG_CPU_SRSO /* From patchwork Tue Oct 10 17:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kaplan, David" X-Patchwork-Id: 150881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp11828vqb; Tue, 10 Oct 2023 10:11:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXpHPupyqtvOn3MxQvK2x1DqUcSyFMdCVdDZcJysVHGWzbioM3SEtMFLw46afSIkv+FTKp X-Received: by 2002:a17:902:eb44:b0:1c3:ed30:cdf4 with SMTP id i4-20020a170902eb4400b001c3ed30cdf4mr16421017pli.4.1696957875430; Tue, 10 Oct 2023 10:11:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696957875; cv=pass; d=google.com; s=arc-20160816; b=rojBwvBLKkAMLVRntmRiDIpIsFtifIZ7bfwhFJmQ83Q3rAcS4E4yGnAVifKNhzhKTx XdwZPbqGbLPxC7c6A2M0+d+Lyo4SbhYq3/6pDu9Aq6dqDCQGlhKWtUfzGea43WNuBTUN y8hTOIKAtcXsp6vg9guovW0UBscfD29BoLDngVINYJcXSef9IZtf7Aza3LmhAzOMqcDt Ep8dmnOw/neBxASGEjmguO8CyKSFZ0IH93mAu7pciMXmuDTSXdSjJI3AqawUNY/dqvOP AbeNRIoRXpB0lEmeoJjFwv6l5Wea5U6DglT08sEu8KjD/J+7sENzOpkEarCyhHtzO8+w 82hQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KwXHSX8fNNQRMALFfp6axk5XS4yv+drNsW2plHNwodE=; fh=mVUpxsDEUPK3Aj+B/5Eb1ZAwKjNSV9Pb4KUQcow5Ypk=; b=qUuJY0Xpy+rzmsu5W0eL1RMKpq8UaMqeoV0Eo/am6stejFlqA2DIbc2IoqVJLQqqxN 89olLATZF4uEGSfBCgS6JaBYeuJazOBXByJytkLjlA47LjBQQVPN/vTs2MIGlXlGQrKw J1L2CUMgRk7IZ2OCS4Zxv5BkhSMuDQkR5lvzquPhiguNJDaTvSRxOwzVztHBmmnW2+or c2tJSC7XWJov/SVjxx9l3U3c0AXP1H05dGcaDP2WAw3Kc+J2uXiJcmC+8xc+i24JL+Fk fIofjM7YBWtcf2BSixzVDnwEkE7e4KlP6aLX1XA9Hf9CevrVL7gcXk7VGROefDw0uT9v ze5A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="sUar7/Ip"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id f12-20020a170902ab8c00b001b9d0ad0d40si11784378plr.128.2023.10.10.10.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 10:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="sUar7/Ip"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id EF1CE80C9A71; Tue, 10 Oct 2023 10:11:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234021AbjJJRLA (ORCPT + 20 others); Tue, 10 Oct 2023 13:11:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbjJJRKu (ORCPT ); Tue, 10 Oct 2023 13:10:50 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2042.outbound.protection.outlook.com [40.107.101.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE346B7 for ; Tue, 10 Oct 2023 10:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6f8VyBADUX+AP+s47y2TaXdu1E5kNFUWrysmT4Mn1bgERG+dab3qeH5rcL21hpx2HDizP/cOBXzGTXwKi37Rs9icpUEW1/npHbK4+Xx4h26eaMKLqV9zMWgJ0c9kf1RzKpUXvoSPreLNMv3ubhVTPhu5d/AEi07II8zzBqyznjfQZkkmgoCNyBmqDVnPTdYffEsxh31Vd4Vsi/CzfGNwwItQiMrgbCamiKNIkYBa829dmb6o2tFRjn6b2pYC7YQfHZG+HiBFCDLcdi6uy+kDWG5K5jPInqgKvbfzPMrBPgk6JUD+ZO6wF+iRnDWG6nUm0idoQPiky4y33UInbIJ5A== 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=KwXHSX8fNNQRMALFfp6axk5XS4yv+drNsW2plHNwodE=; b=kXCMhIKcbgnPBKNyloeAucRBVZCNyKdJ3hVE2iOyxznznzAPhyH1sHDzqhJTLSLp5dU/VvNItaGXj1GXcjHqSB4rlcErxR+WF8WCkN1z7ClioSHNB62X4v49E32V2BEsh/tX998P72VPj0PLkcCGleqeJJfg9ebHU1N08zjZ/cWi18ey/uzJdIlePvHRxTUMBam+QBJlXuH6rEzZFFE6b2orpJP9Xto8yfu0Xaiota3gxZ+MayDalIFMjjc0+w+79BThhLYHMKmPOQuJoD5IaoI2BAu0QFNmByiUOWc3baA+egAtWTktsgAKL2NwfYTBEpf2TeiQrYb57fsTkT3jkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KwXHSX8fNNQRMALFfp6axk5XS4yv+drNsW2plHNwodE=; b=sUar7/IpXEAWe5zD00jlQPLii5dVtEF94xRem8DBsTn55OONmgQd2Pelk8KEle10UDkM3x4V7GvyJVw0Xhm5atd27WrUUTowfk66aRPdJMfZ2IOw6e7K46mZSnVOsbezHDR6HUXGLe/h4ndtFV5Ymnazhzvr5fjf4K5+mS26LjQ= Received: from MW4P220CA0011.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::16) by DS7PR12MB6072.namprd12.prod.outlook.com (2603:10b6:8:9c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 17:10:39 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:115:cafe::87) by MW4P220CA0011.outlook.office365.com (2603:10b6:303:115::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend Transport; Tue, 10 Oct 2023 17:10:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.6 via Frontend Transport; Tue, 10 Oct 2023 17:10:39 +0000 Received: from tiny.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 10 Oct 2023 12:10:37 -0500 From: David Kaplan To: , CC: Subject: [PATCH 2/3] x86/vdso: Run objtool on vdso32-setup Date: Tue, 10 Oct 2023 12:10:19 -0500 Message-ID: <20231010171020.462211-3-david.kaplan@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231010171020.462211-1-david.kaplan@amd.com> References: <20231010171020.462211-1-david.kaplan@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|DS7PR12MB6072:EE_ X-MS-Office365-Filtering-Correlation-Id: e203a7c5-3acf-4f40-70dd-08dbc9b3d408 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: etnfVVsBKWKMY+XNq7chQmFEBk6haDqP/aYei5LzBGCj+wfm07YS/fEmoOcWfp1x3dci1GtRUKEOb5gTMENAEzF9cWJpGqL/8OK6fojSHvMb48XeTI97kEoF70bYayApsI+z1erOa3DBuklQuLJlgeW2hS00UvJrDiPbWkq1OpZn6mFF27ivxFYJAyTgKhDPOPTg0AsZWrLQUMp11+sf9L67cJU6IHgQeLLzRS0CWkUIFGaoJ9cDiqAnGCHUOzy7CES7bPc4dPpru8vKvBlJVF0eOy5eLPf7ansEuhMbXdRvt3cPgZ28dwHdvQwppGmwtfjtFaYK4VPBOnICv93d5coXCtXkp+ThRTOK+v4nsxlzdBvmxXpDbHniWOARNWi3uWp+8wP1SvbZ6b9uxDT4hco9KPDSARrbwm4e25WezXDkhQGdu9EaJt62Nx8xQ+3ZS5EStuPYMd7fLMh5aPpGfjgnfQM5gZis/YrKqWzTkPGaeN/sXi2bhcP3Fct1flHX18MUoK2G3C6k7J8PoHxdAmxMx848tCysVgjnMfq+LQYrHd4rjEfVIOzYV8u92RfAHcl0zFLzdUDh3f/fGoUx1K5iES2zRxhxjE/6PWhliexeLPIpEG050XyvjEJNwExIR5o0ztyYBMXh90EFBQLlbw9T+6/kdTWv1PRH0w8Ld4DKDveespG0XTXV90eSQYgiog25zJeMkNBrF+yDSHwRULZly+v8J2VCqkVTG1X7+Ak= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(396003)(39860400002)(136003)(376002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(82310400011)(36840700001)(46966006)(40470700004)(1076003)(7696005)(40460700003)(356005)(36756003)(40480700001)(86362001)(82740400003)(81166007)(36860700001)(336012)(16526019)(26005)(47076005)(426003)(44832011)(4744005)(2906002)(83380400001)(2616005)(6666004)(478600001)(8676002)(4326008)(8936002)(41300700001)(5660300002)(70586007)(70206006)(110136005)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 17:10:39.4365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e203a7c5-3acf-4f40-70dd-08dbc9b3d408 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6072 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 10:11:13 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779389301424430498 X-GMAIL-MSGID: 1779389301424430498 vdso32-setup.c is part of the main kernel image and should not be excluded from objtool. Objtool is necessary in part for ensuring that returns in this file are correctly patched to the appropriate return thunk at runtime. Signed-off-by: David Kaplan --- arch/x86/entry/vdso/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index 6a1821bd7d5e..83c0afb7c741 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -42,7 +42,8 @@ vdso_img-$(VDSO64-y) += 64 vdso_img-$(VDSOX32-y) += x32 vdso_img-$(VDSO32-y) += 32 -obj-$(VDSO32-y) += vdso32-setup.o +obj-$(VDSO32-y) += vdso32-setup.o +OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n vobjs := $(foreach F,$(vobjs-y),$(obj)/$F) vobjs32 := $(foreach F,$(vobjs32-y),$(obj)/$F) From patchwork Tue Oct 10 17:10:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kaplan, David" X-Patchwork-Id: 150882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp12039vqb; Tue, 10 Oct 2023 10:11:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGh0kYytZYr5TEJA/nGLtkrcJ07B0dueQ0aahjySnip8kb5tyEqOVGieGUqzGTbkQrtdNUX X-Received: by 2002:a05:6a20:7fa8:b0:159:c2d0:9fc6 with SMTP id d40-20020a056a207fa800b00159c2d09fc6mr23975933pzj.8.1696957891162; Tue, 10 Oct 2023 10:11:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696957891; cv=pass; d=google.com; s=arc-20160816; b=DAm/uJAkcoELo63aoH8gh99Jvkag4uB3vc5dpxFXmWl7CpfSw5Bs3Sr69SqlGigRBt /3361mtKKdWEBCIl9McMN6fafVvpizI0fNB6rU74MUQemknQ4tSs+OvJpPb6Df534eYV lqlWpZoUoszxbE9k/syL0mIuyNGGglYFqCRkFPJO0z9sNXJF0OykUxExdExifySU8lJ8 xHXY+uFiht0KWkUghJZ3QJFtonorUTR44kX+KVAuJCJlaS/FW4rJ1lV27y3OgsYFQEA3 +4jvwSohaQjJxYlbfk4AsErlgNA5/BJ1E92l/8q2I0XEHhi2BI3jbsQD8eSNh8h6GcxI rbhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ShsxksQCBU+sYJtQmS5RnFGE4ATRkKsS1l9HZ71b+WI=; fh=mVUpxsDEUPK3Aj+B/5Eb1ZAwKjNSV9Pb4KUQcow5Ypk=; b=mbT9qbK4ibCTn140MmEKdAkQIEXb0ZRrUXXh5sRnN8wFcLmwrHVC6Ks7blbqEkKhob j2nezoTBiw6BjBWBSZbGID3j52B37sYsKW7ZNrFsUQjNd60+QfgHZ5detee0OKbTrQxb QUJk2thLeiD4toahntbao5O43Q71PXyH8Vvho/0rsE2opK68kzuYLd36gu138IbQG7GU Kzldxp3G+Y9Lp+tbD07TDcgWy1nLMsr2rjy8+wmI8zuoPQvhs6qWDL2OwWBH+XH53sla u3J3ePJLuAUwT/sdZe01w4eUOO0bPJl/qRnUoRFxVcHt3QyKeDawS47u7G4psgllc03M K0sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=SNM4fg6l; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id b75-20020a63344e000000b005859aec9406si2021685pga.16.2023.10.10.10.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 10:11:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=SNM4fg6l; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8864F806114E; Tue, 10 Oct 2023 10:11:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233505AbjJJRKu (ORCPT + 20 others); Tue, 10 Oct 2023 13:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233629AbjJJRKr (ORCPT ); Tue, 10 Oct 2023 13:10:47 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 989D194 for ; Tue, 10 Oct 2023 10:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g72D7d0WCfwGKUAWg3b4rQhoLLFL8qVvwygSAOvomcSIIuwzBXXhL+H1ANkHWvzX/bh6ypqW9A2fg3uA7jxgW+lJY1KAiD4hCO+mqATAgyTibxMWCPOAkeEi8Kbf8U055jCZHEkz5Ljr7AnfOod9uRYyJiqqF/y5I2yIpOtsPn71xItSH12AOs3VafmoVvZusyffzZ95su1KWvAUWtAH/upFLmSQZhOIN/UsIVKVDSfcG3tjyo/+Y1Y9IB/vieXmL5lkqjFaMx2XQJ94JoNjZGbQsauUwBo7O8n0kZZgggOHbHzY6pXnAk31N0lg9sl2TLxIjYocskf3FcFfXF4E8w== 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=ShsxksQCBU+sYJtQmS5RnFGE4ATRkKsS1l9HZ71b+WI=; b=nuIpmIWFtpQqssdjRkJpCGYrzlrKuaEC/Os/XcfnJI6iMBL3DQpIxRl9Bx/BGmvj+bsXPKniqZg08GRXBlD6W1Hz9xOSdUlTjJnKCBkmWgIjRXTN3LBW6gzKTTpeIDNKvIteI9thJJ5ekYdyLvRfhmZiV4JOxWTCOOvaVf6h46zPudyBLggapIX2aT927qlKqBMI067p2UEIEwqhkQ6GRbfROXz4NiKaXABrKHt9jbFkTmJQB87XYv8Ix4j5UzOeuNs2W23/9UoozA1YowPLhZPwag4xldzNJZdT8fY9U4pwsrX4YjGfIviAP/EY3i1EXNBGlqNAoj91QfY9fxtvDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ShsxksQCBU+sYJtQmS5RnFGE4ATRkKsS1l9HZ71b+WI=; b=SNM4fg6l135k1zowTtRq5K+6vSPkZCpD65214wzqEsazJkrgocqUDocvLEUtpCYniWSLQSLMvJZUZeHS0yyz6PSC6l/19h4qzteRa7p72R0Ijr5l+7QGixg8x3zR1lNRCAquxObA5TkLAzv6dovnhcG0FvqPKw9dcJ36TFOZ1ag= Received: from MW4P220CA0013.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::18) by IA0PR12MB8227.namprd12.prod.outlook.com (2603:10b6:208:406::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 17:10:40 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:115:cafe::5d) by MW4P220CA0013.outlook.office365.com (2603:10b6:303:115::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 17:10:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.6 via Frontend Transport; Tue, 10 Oct 2023 17:10:40 +0000 Received: from tiny.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 10 Oct 2023 12:10:37 -0500 From: David Kaplan To: , CC: Subject: [PATCH 3/3] x86/retpoline: Ensure default return thunk isn't used at runtime Date: Tue, 10 Oct 2023 12:10:20 -0500 Message-ID: <20231010171020.462211-4-david.kaplan@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231010171020.462211-1-david.kaplan@amd.com> References: <20231010171020.462211-1-david.kaplan@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|IA0PR12MB8227:EE_ X-MS-Office365-Filtering-Correlation-Id: ae2c7f24-709c-4f95-0a33-08dbc9b3d463 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 50r1pv1iS8iN6ApKzm7EAU74/GG84G1cpJbP3eTkRS9r3bSmKrgI++C4TCygqzjv6MPPI2+V8USSqosJ3EaK3AT/Cdf+WnyXircevwWPbKZ57gG61HsSBVfM+4AU87yhfNSJFzHXGxhyOsjnW43v0V2JssEfmO6CRW17rnzAqk2VURoS9JtzF+XqVSEsIyT37G82A3TNwtGsKs6MgMeygU/GD6CDyyFup0h3sSloIg4mV3FI/bjIxlx/DFzJ1wEqhkI2B6eCPMS2bYtMMhov0gbrJ9J2+ec02ZpbcUJxkNWbcfG2CX1NOqRmIONW6CMeHbo0kOBoL+2vZURkyPTMiMk7FxVU3sGKcrzpbzO6/6ZRex+krM82txEBkyvEAtB9omPG94Tz+t1/5Nn+V934oGH0yoWz/ysKx/uCagpMNfDdtshncScsCo1Up3yXBOMcqktMNIp12ptv+gSv+/9tb0PS1ZnXHSYlF3NuCfZl/uQS+mevi5dbME+PD32QjIqmyIDXXC8OvxpGftH+HTdTz+pgS1qzcptXqlRikw8reSF0iinfDPPCerZeitSFcmvJAFQzIslrll4PdSz431Ii6Lh9CCMmmXLWRASNGAx3HHpZ6FADKu4eym4AbE+XyC3S8LFBu+iwwzLnEjeUjuAbN5iDiNUSK+14rcmcTPG7sQZ9hvv9HDKoks3DU84ibid1ZlA+HWODSFi57W7q/4OFiLLKZ530jgkxNvoIm6dDkCk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(136003)(396003)(376002)(346002)(230922051799003)(64100799003)(186009)(1800799009)(82310400011)(451199024)(36840700001)(46966006)(40470700004)(40460700003)(1076003)(7696005)(478600001)(6666004)(47076005)(426003)(336012)(26005)(16526019)(83380400001)(2906002)(5660300002)(70586007)(70206006)(110136005)(8676002)(44832011)(8936002)(4326008)(316002)(41300700001)(356005)(82740400003)(36860700001)(2616005)(81166007)(36756003)(86362001)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 17:10:40.0927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae2c7f24-709c-4f95-0a33-08dbc9b3d463 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8227 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 10 Oct 2023 10:11:28 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779389318000603171 X-GMAIL-MSGID: 1779389318000603171 All CPU bugs that require a return thunk define a special return thunk to use (e.g., srso_return_thunk). The default thunk, __x86_return_thunk, should never be used after apply_returns() completes. Otherwise this could lead to potential speculation holes. Enforce this by replacing this thunk with a ud2 when alternatives are applied. Alternative instructions are applied after apply_returns(). The default thunk is only used during kernel boot, it is not used during module init since that occurs after apply_returns(). Signed-off-by: David Kaplan --- arch/x86/lib/retpoline.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S index 3da768a71cf9..10212cf4a9af 100644 --- a/arch/x86/lib/retpoline.S +++ b/arch/x86/lib/retpoline.S @@ -358,15 +358,17 @@ SYM_FUNC_END(call_depth_return_thunk) * This function name is magical and is used by -mfunction-return=thunk-extern * for the compiler to generate JMPs to it. * - * This code is only used during kernel boot or module init. All + * This code is only used during kernel boot. All * 'JMP __x86_return_thunk' sites are changed to something else by * apply_returns(). + * + * This thunk is turned into a ud2 to ensure it is never used at runtime. + * Alternative instructions are applied after apply_returns(). */ SYM_CODE_START(__x86_return_thunk) UNWIND_HINT_FUNC ANNOTATE_NOENDBR - ANNOTATE_UNRET_SAFE - ret + ALTERNATIVE __stringify(ANNOTATE_UNRET_SAFE;ret),"ud2", X86_FEATURE_RETHUNK int3 SYM_CODE_END(__x86_return_thunk) EXPORT_SYMBOL(__x86_return_thunk)