From patchwork Thu Aug 25 10:20:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12954509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CAFDC3F6B0 for ; Thu, 25 Aug 2022 10:37:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kOo7Q2r7KKmcNwIlA7kbpPa9UpL6XWZ0UUpoqaUyLVQ=; b=z3yctGa4iTbu3C hfxHxBwswoKgvYQK3m1kObH2fs9dQcCx1C+V+F9ZG42HcA29vcrIratm0Yq9pxsybX9rHIu6ZFLvI Rw/wl90p3m2EvCicOLbxPXfDsp3YOHS0Z0DT496qKGrstr/BlgdLk4iNS1xOnAitXSgCjautqwYYO 8R9OvoGOfGu+DM4b996YEVWd4LiDLiubEbZ4eWWU9ywr2Ts2KilLvmoTZDqem+SmthAzunCZ1UwTB /caR+QNgAHOJM1//qBqHCUHyfQpIhn+HB4lanwsCU6iAr9wwjiStW/ILUmtQxkd+AJSJ/9qlHdKVP sN5IYfEhVhje6zXRrFxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRADW-00Bx1J-2F; Thu, 25 Aug 2022 10:36:06 +0000 Received: from mail-eopbgr70045.outbound.protection.outlook.com ([40.107.7.45] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRADR-00Bwy0-Oc for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2022 10:36:03 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ZjHPlm5LKSY1PByrKTDx/JPj8AVUZ6eJPa/YuAwEzw+qaoknHzNe3fRFjRJSUwxRoet8NiZZmo2M+nc5vtg0hhy5cvj0YUS1itfvjhfQQ6lYEuwDmSfZORSfRpdDo/peRfTwJiIe53s6ydoofr6kTpvjRzp5BzCdim16VEelFzBrqnhey4A6dfGc7PfWS18sOVzyYdzpzYxc/L+flrjxEu4XrdYpPrBxmZKkpYzcKLp1nX6EmGQXEhvLAmr/gJ4+DeZ59HMFrDEwLwKgbxz01s3DXZpQLnC6g+NYbY4U3qCpCoFfyTveSUhwrnfzTdIHYdGlMdKvytKQ83eHz8FIPg== ARC-Message-Signature: i=2; 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=1fLdPt0t68akl5e5XVfMQMpRV669lMKEDCfM8heown0=; b=QL2iDAc696nVJLlNQymNciv1Rr6fJQRBQnKlcHhCEtfbS8Qu/0gBXTdygkXPIPHLkP753yEO9vwZXBrb8eEUuvpTJoogPuy8ZF0jnu5bXUzsXlA00ye9+NTbr2NZAvwGwwuhNBLX6Hu0ebTNm8+1wqdy7z5b5xKQp3Da47Ek4HDlRRtkQQEMRvz9eiKI2SqSdvxt1dVY6GfN1Ysy9bQi6uRwGJGXq/8Cf9f6svfKMV4ek65dmNdD/8LeSTCDoPXrnZqd/7mgxu05SmGTvf/TgSPIyskApKOtJqpPvcjn1v36ryOOyjJvbgh0W04HEHruMpampYIzJ/sXoGw9X2bCSg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1fLdPt0t68akl5e5XVfMQMpRV669lMKEDCfM8heown0=; b=5TAtEUjznT7n8hK2x/aegPQa1IyZBD3T1Tg8gZ4m7TEDRVh5NrET+HvMQ7sjWbwYH28RHX5guFJKKy8RS+ChTOY9hgtZ5+b9lo5Vqi4vXjKEzb7R7aDbIl20YqjuaYhvpiGhBdvF7nzIu6jzIA1agxBGB5F66L0x7Xh3ylUoZys= Received: from AS9PR06CA0201.eurprd06.prod.outlook.com (2603:10a6:20b:45d::19) by AM9PR08MB7226.eurprd08.prod.outlook.com (2603:10a6:20b:411::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 10:21:09 +0000 Received: from VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45d:cafe::19) by AS9PR06CA0201.outlook.office365.com (2603:10a6:20b:45d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.16 via Frontend Transport; Thu, 25 Aug 2022 10:21:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT003.mail.protection.outlook.com (10.152.18.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:21:09 +0000 Received: ("Tessian outbound c883b5ba7b70:v123"); Thu, 25 Aug 2022 10:21:08 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4ea891e1824a50a9 X-CR-MTA-TID: 64aa7808 Received: from 1a57fd3d8efc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 607ECEE3-A781-4F91-A414-DF1673AD25D5.1; Thu, 25 Aug 2022 10:21:02 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1a57fd3d8efc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 25 Aug 2022 10:21:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PrqYQRuy9r/5h4d8DhEqhJGdTheji8FDxKV0JqzqO1oH3Jj0PfAlIJyOIZr43KaruY1B7PQ8mxRatM5a92JErv8P+E9cYdVPSrpsoqeHamQoR3gMUXoxfDX/O0XL9T5e3Z6vyX/QI49xlJbh2/OJHQRLzX7lejBIQfLfE8gVCijVJtCotdayNllp3TwPxAUCjwKLpx8F8qkAyMU/EbMgfjbweDr9FYH10HZAlLJwrJeOyg9I+j/KIHw9NCg/HkgCJ6KD8Nd1wiVHfzGRQwA9jEE1+3YIztjED5q9rDnqVLTf60v8nmErIL4LR/bYKlTGCmT0NL9oGHRpN6XiHU0B9g== 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=1fLdPt0t68akl5e5XVfMQMpRV669lMKEDCfM8heown0=; b=n8h5Adj3MSRa5XoqKJwa1EWkV0GW9sYTRp6nZh+M4ejXhi2LhexSsLvRvIuYRYm3U9IgISvFGUX8Zs0oM6nSV4J/EQDdUWYK67USzeYBrqyx0R9jUpzm6wagI+LjPVFWfd+qA9iy1meQYTyLd/vT5YCmCbbmUL7pMIxGis1dci990XjSM7bWoybH31BTOQgqdYstx46zHR6F0Diuve4n6eyHCO/MmwfypeYDGJpl0uObuFKZCauKUHclx7xz8jpX4FUJRPqovUwkqLAvOO7lsPjMwtx0BcpliEeliwRVdZNUxhl2AxfvN9haknv+C4OFiVBrkm7GBmAt6Qp7Ih0H/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1fLdPt0t68akl5e5XVfMQMpRV669lMKEDCfM8heown0=; b=5TAtEUjznT7n8hK2x/aegPQa1IyZBD3T1Tg8gZ4m7TEDRVh5NrET+HvMQ7sjWbwYH28RHX5guFJKKy8RS+ChTOY9hgtZ5+b9lo5Vqi4vXjKEzb7R7aDbIl20YqjuaYhvpiGhBdvF7nzIu6jzIA1agxBGB5F66L0x7Xh3ylUoZys= Received: from DU2PR04CA0073.eurprd04.prod.outlook.com (2603:10a6:10:232::18) by PA4PR08MB5903.eurprd08.prod.outlook.com (2603:10a6:102:e9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Thu, 25 Aug 2022 10:21:00 +0000 Received: from DBAEUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:232:cafe::2e) by DU2PR04CA0073.outlook.office365.com (2603:10a6:10:232::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:21:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT047.mail.protection.outlook.com (100.127.143.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:21:00 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.9; Thu, 25 Aug 2022 10:20:32 +0000 Received: from e124191.cambridge.arm.com (10.1.197.45) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.9 via Frontend Transport; Thu, 25 Aug 2022 10:20:32 +0000 From: Joey Gouly To: CC: , , , , , , Subject: [PATCH v1 2/3] arm64: alternative: patch alternatives in the vDSO Date: Thu, 25 Aug 2022 11:20:24 +0100 Message-ID: <20220825102025.53916-3-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220825102025.53916-1-joey.gouly@arm.com> References: <20220825102025.53916-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 4727f03f-7786-4a6d-2520-08da86838713 X-MS-TrafficTypeDiagnostic: PA4PR08MB5903:EE_|VE1EUR03FT003:EE_|AM9PR08MB7226:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: dWupk/AZYIlPuGP//IQfNE/Cnmal82t1Ztrex1AzAp821Ct9cUNN+/yLpjPR0ob3Nyy3jcgPS7z7WbERP6xN7/GSklEdF5vYc5OCkqkJ9mg+hvuRWirNN8L7feTSan6dR+J5+PEjdY/K+oj05ycbR38LOO5L2I1N8i1vKuWO8ucO+NRqDzp/dqVaxs1sOycQlOqvZPHBbgexV/GX/dPFJhPo0LpxioXQwsY75IST6tbCbTaJ8kmZYkMALOTyL8bzyPmbo6KZaGP5Xr7BCuEILT+ASg5Llw/QhmfQmHxizBabD+Uh8qc3HWvwgnmQ6NI8ji9eH0NdTinSUa4hD3QLldgV+Dxa+CyxUGAOSeWFctgKgG0eddRu8KHVpMGQXTXgH9JIhp4MsUpWRm57ZVAinwyCfsJGfKKeowArvAGIxEgFavrOJU72txIBDU0acxQn9Ft9NSZNTs+OXbuiQj2x7VDGmE1U5JYu79295NBN1S70kxg2jz0yxuGUnCtTU11977j0AjjAkkLUMzHnzssSPsz7+mCAv6TaE5kDHxwpOTzx+kzAc5Le4SteBUVenT7GvaZXwbXsvrX79xki7HNz5c8jJs4LYxHFBpov21gtfJ1VXq+I1e808MvYqlDDg0AuBBnW6ZI8mvK63x6wq5D0sKdCqGBNMCZW43l1Z+f3FPBzSDUXSUP6MYx6An9aPI9G5oDbLryFJdhttJEGVC1fT7URWUBwNXf5Gr2dQeZZ+JDI5QZXeRQT350IOCf58vV/8cOa7+AIW8uc7pn9Bh/uxGRDgn4Hn3mLxWTH5FqCLrKiPqr7W7tOiQFLsDZdIMYb X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(396003)(346002)(136003)(39860400002)(376002)(40470700004)(46966006)(36840700001)(2906002)(6916009)(82310400005)(36756003)(4326008)(70586007)(70206006)(8676002)(6666004)(316002)(478600001)(54906003)(7696005)(26005)(40480700001)(5660300002)(82740400003)(81166007)(356005)(86362001)(40460700003)(83380400001)(41300700001)(426003)(2616005)(1076003)(186003)(8936002)(36860700001)(44832011)(336012)(47076005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5903 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b958b245-76e6-4212-e652-08da868381f1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yQ2NCz+KiSX4mmaS0vBjwnlPprgMzLZ70PZA+lr+MyJI08CXnGf2Fa8Tc0rCg0/S+uoyZxvntJXAHiAaQfVsSwn75vGDf8O/0fzp8/zJsL4H1/h9NLQF75tBRq7E3qTBvGkqsuxgev3LYi8DlO9mb254k5KEAHNznm9VzqfjpSw8brAz/o/Zz6Ul56IICdHB5p/rwDmYrYTUJBEgDdoQgyajXdLo7CRtpLemrd2uHW3cRC6Eh0ObOfSj7Ul2LsKKoN7TK0+X2XWL7WCvRhhxzAsIFYJQjIgzVrCJe76xY3wtrT2FmB2isBgjsrX/Bnat16IdjkK54/1Irqxbl5+GxY2a+NF5Ev+kbliZq522DBX/4BytlNinxaTLqgO12vEQ5rd9SX/XgsRD8kFfGfbhFzJ3Z/iI8dgumaxuN2a19kH+9w8eYXGNHhFj3XLWrvf81IbxSrAVxTwkLznkk0a/fUcdYeq1bGlboazELZ7W2BiY3T5y3zQTFiD9yPmSL2fiu+cZwuo8Xd86Sa3YwWZhSOLvogKOqGhOJMjLSCv6ADc61RXLYQauCMQWbF5+hMDnzxN/HNzJ5IMl3T4jmA1GsLMQXhu0U2QUsvPOAPfTdPfeyKSIEFLZfPTrWSpVHylLUtnouhDSprjBGYHDzJt67rUxwg1SAqNhuDFaYifE+cLkPqZRyl0/51qVJwrDP/+GKAO7CYhpj0qOq6gB5C7zb4S5agFg+Y7UKc1uW4SDewJp2wshQXTMiLgBP1N6y4r2OIfire1gqFT+EAtZWkQAzg== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230016)(4636009)(376002)(39860400002)(396003)(136003)(346002)(46966006)(40470700004)(36840700001)(41300700001)(36860700001)(7696005)(6666004)(86362001)(107886003)(40480700001)(316002)(6916009)(478600001)(40460700003)(82310400005)(83380400001)(54906003)(2616005)(81166007)(426003)(82740400003)(336012)(26005)(47076005)(1076003)(5660300002)(70206006)(8676002)(4326008)(44832011)(186003)(2906002)(36756003)(8936002)(70586007);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 10:21:09.0269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4727f03f-7786-4a6d-2520-08da86838713 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7226 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220825_033601_979710_8D0B5747 X-CRM114-Status: GOOD ( 14.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make it possible to use alternatives in the vDSO, so that better implementations can be used if possible. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Vincenzo Frascino Cc: Mark Rutland --- arch/arm64/include/asm/vdso.h | 3 +++ arch/arm64/kernel/alternative.c | 25 +++++++++++++++++++++++++ arch/arm64/kernel/vdso.c | 3 --- arch/arm64/kernel/vdso/vdso.lds.S | 7 +++++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/vdso.h b/arch/arm64/include/asm/vdso.h index f99dcb94b438..b4ae32109932 100644 --- a/arch/arm64/include/asm/vdso.h +++ b/arch/arm64/include/asm/vdso.h @@ -26,6 +26,9 @@ (void *)(vdso_offset_##name - VDSO_LBASE + (unsigned long)(base)); \ }) +extern char vdso_start[], vdso_end[]; +extern char vdso32_start[], vdso32_end[]; + #endif /* !__ASSEMBLY__ */ #endif /* __ASM_VDSO_H */ diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c index 9bcaa5eacf16..a4036194a5cd 100644 --- a/arch/arm64/kernel/alternative.c +++ b/arch/arm64/kernel/alternative.c @@ -10,11 +10,14 @@ #include #include +#include #include #include #include #include +#include #include +#include #include #define __ALT_PTR(a, f) ((void *)&(a)->f + (a)->f) @@ -192,6 +195,27 @@ static void __nocfi __apply_alternatives(struct alt_region *region, bool is_modu } } +void apply_alternatives_vdso(unsigned long *feature_mask) +{ + struct alt_region region; + const struct elf64_hdr *hdr; + const struct elf64_shdr *shdr; + const struct elf64_shdr *alt; + + hdr = (struct elf64_hdr *)vdso_start; + shdr = (void *)hdr + hdr->e_shoff; + alt = find_section(hdr, shdr, ".altinstructions"); + if (!alt) + return; + + region = (struct alt_region){ + .begin = (void *)hdr + alt->sh_offset, + .end = (void *)hdr + alt->sh_offset + alt->sh_size, + }; + + __apply_alternatives(®ion, false, feature_mask); +} + /* * We might be patching the stop_machine state machine, so implement a * really simple polling protocol here. @@ -216,6 +240,7 @@ static int __apply_alternatives_multi_stop(void *unused) BUG_ON(all_alternatives_applied); __apply_alternatives(®ion, false, remaining_capabilities); + apply_alternatives_vdso(remaining_capabilities); /* Barriers provided by the cache flushing */ all_alternatives_applied = 1; } diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index a61fc4f989b3..ac93a2ee9c07 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -29,9 +29,6 @@ #include #include -extern char vdso_start[], vdso_end[]; -extern char vdso32_start[], vdso32_end[]; - enum vdso_abi { VDSO_ABI_AA64, VDSO_ABI_AA32, diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S index e69fb4aaaf3e..6028f1fe2d1c 100644 --- a/arch/arm64/kernel/vdso/vdso.lds.S +++ b/arch/arm64/kernel/vdso/vdso.lds.S @@ -48,6 +48,13 @@ SECTIONS PROVIDE (_etext = .); PROVIDE (etext = .); + . = ALIGN(4); + .altinstructions : { + __alt_instructions = .; + *(.altinstructions) + __alt_instructions_end = .; + } + .dynamic : { *(.dynamic) } :text :dynamic .rela.dyn : ALIGN(8) { *(.rela .rela*) }