From patchwork Tue Aug 30 10:48:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12959107 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 1388CECAAD4 for ; Tue, 30 Aug 2022 11:02:44 +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=d9pht2/vEVFpRSQH+6wJPZBp+CAXX0J4vGmAdP9dYOo=; b=je/Z6EQp0pv4Uh C2CwBW94g7ZwoNB6FWi/3JEF4icBKmE4fWCcHM1OOB8JodTImOtfottcrxLLcv/U40WwYM30xFpjo 24ZO3+K37dsc9cnEo1D9et4OtgmjC+LHzDaQ8izc40hYJ5rYBuJnnRF8yMoKiXSgheQ9N3l6D6m7L 5jMnfL50u5ZuPzA9kQ10UWYidk9CeYfnIYjaG4yCe2iXdDaSV8M68Jq/9t+afISJTIh/Yd96j6xsa QwmRD/nunFiHA7Tqm6LdeNfzNilZ3NiIp0/ggLzRzT+uV+pOGG1G3iUup3Ik2TwJSf40PmMCl9+QZ HNyleSd6ahahve1L9ISg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSyr6-00GIvX-KZ; Tue, 30 Aug 2022 10:52:28 +0000 Received: from mail-eopbgr150057.outbound.protection.outlook.com ([40.107.15.57] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSyo1-00GHza-Vb for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2022 10:49:22 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=BPb/8R9+/TAin3roxeGdOcNNcM7B3Dy1HDx9ZsDWiyldhoYv4/IFjeHlClKsUoFJvhBAGz0SzAivhGvvVbkR/oTJw4dNQL9ETs/vsJpDQh/l0G962xYtLOfWGsdTFsI/k0rB6g42i2OafFikBPHCrG/Km/b4P7kOyB/fSWiTvI/ZUejMtS8sVUBz9mMy84imbVc00tk97bT6HQ+/+o6nczFVafNwo9lPxxnkOySYHsl6ORyveVKi7xM6mEhiclJLLlM1cwEmtM+uWjsuREqF/mUDH5i58BEzxzQimqHGrybVIXvmKzx//0TEtepGLDcaU8eCR4tUoAixGZP608Kg1Q== 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=d6+/UCR2MiSnuqgte8oXEX+334tRoHH8QDkDUsdRZUo=; b=OKPHuz9yDzvLMJWeZUSSCgxltoC+Q0JwTHMe7+GufguEIeTTJGEOzVbMb5UmXnwO+94MwoN871EBIlaDHzo/OclcmU4eVB2KPCm9RzNEu2sKZz/L2nUoiS+iZCBKTxR3VWZ1sVpb+G7Snv/b/5v/0oYQzXBA5FwTTy3eIBVjhKxpFGWvlZXFAGwPmhKWqXp+aqywvxsmIKotJXHxFsdrPKCetnQDKnwrwK55kybqcC/1msg4hUi820TxCDa5/y+U5DXWTMr0cjUAA551kYpK//pjdTJCYJ8ig0Eqs015jTPu/v6BjW3WmmDntKtHBA6YMgTolVruKUOvr+P2d2br+A== 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=d6+/UCR2MiSnuqgte8oXEX+334tRoHH8QDkDUsdRZUo=; b=n/EVfu3E0PFm2p5t4DkL7XKUCF9u0JhTl29Rd7fry0ZtOuF35KvZsaoIXlmzKYnGm/JvNdOu7PXDmyY3IYovK94AB0OsN/8fJQRzBZjpNjX9KQL/YAePIZSKCSl9qI7kzwU5P2tzNGovpwDtuAW+r068zx4qXFUiO7NN605y+ZI= Received: from DU2PR04CA0069.eurprd04.prod.outlook.com (2603:10a6:10:232::14) by AM9PR08MB6999.eurprd08.prod.outlook.com (2603:10a6:20b:41a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 10:49:10 +0000 Received: from DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:232:cafe::e6) by DU2PR04CA0069.outlook.office365.com (2603:10a6:10:232::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21 via Frontend Transport; Tue, 30 Aug 2022 10:49:10 +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 DBAEUR03FT054.mail.protection.outlook.com (100.127.142.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:49:10 +0000 Received: ("Tessian outbound c883b5ba7b70:v123"); Tue, 30 Aug 2022 10:49:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f6ab031f17d23de4 X-CR-MTA-TID: 64aa7808 Received: from 9350c361415a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BDA31C4D-D037-4C5B-BCA4-C99A8BFAA9E7.1; Tue, 30 Aug 2022 10:49:02 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9350c361415a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 30 Aug 2022 10:49:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D7llfDyX++gZBH5mJ3Acbm0GqWFvbal2/Lr3+3pG8Si67ZUAKNcA1AkDQDHDxy/GPTt1MmQ1p6Xj+Qi8AJnUGDDkzAjJZtKgf5/LiJhewK5N0MEDBra+KMC4cjaOlOSp7ahmSco1M2i5IdH+BvBIAFfnD6dc1NT1n0AOf/CRG5TLCwbQci0qkl0k0Qj7Ue0nTsDVDI0QQGUKWwm2pqhknlyQg5kAxZYa/ntLPUXVDBRMbDs8X/YOamyp2qXhMNMcyoz8kHRHA7KvTyDjms5nxJUz8P1yQ8yGIS6lgR+bg1wHrB209Yf/tXBAM5HOM3iMCyuWpX7lZc7bduxELMj5rQ== 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=d6+/UCR2MiSnuqgte8oXEX+334tRoHH8QDkDUsdRZUo=; b=Wwz/fBvL7gP4JkAD5h1FUAzFEE/sItJJWb1dIJl46sqQPAOCe7klqZzqaOufG1joWEw0CRoTYetPXA2+G8+lnYp9fzxHn6uxpnnudBBklBEgW8cjEzKhmN3ENWvKuHnVkHYSODzBswH51AX9uFcjlb+am1vK6DKgUlF4cBrbkJ7YPbuYuKGqCImdmfyZ2cMd8T7t9r5LSLXOFat14xEOtmzikSURFJxpgVkWVPZm7MwRbbFXEOIIBkuJvrXo0KH1jHtT7kq8tZvvEeMyojPryNrVZlEO28t9gnV8B+gVN/N/UnqrQrTI72E4okkqyHzyE1rgwLgpYdyaEZZwYTeKZA== 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=d6+/UCR2MiSnuqgte8oXEX+334tRoHH8QDkDUsdRZUo=; b=n/EVfu3E0PFm2p5t4DkL7XKUCF9u0JhTl29Rd7fry0ZtOuF35KvZsaoIXlmzKYnGm/JvNdOu7PXDmyY3IYovK94AB0OsN/8fJQRzBZjpNjX9KQL/YAePIZSKCSl9qI7kzwU5P2tzNGovpwDtuAW+r068zx4qXFUiO7NN605y+ZI= Received: from FR3P281CA0070.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::22) by AM6PR08MB3416.eurprd08.prod.outlook.com (2603:10a6:20b:50::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.16; Tue, 30 Aug 2022 10:48:59 +0000 Received: from VE1EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:4b:cafe::ca) by FR3P281CA0070.outlook.office365.com (2603:10a6:d10:4b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 30 Aug 2022 10:48:58 +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 VE1EUR03FT053.mail.protection.outlook.com (10.152.19.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:48:58 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Tue, 30 Aug 2022 10:48:38 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.9; Tue, 30 Aug 2022 10:48:37 +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; Tue, 30 Aug 2022 10:48:37 +0000 From: Joey Gouly To: CC: , , , , , , Subject: [PATCH v2 2/3] arm64: alternative: patch alternatives in the vDSO Date: Tue, 30 Aug 2022 11:48:32 +0100 Message-ID: <20220830104833.34636-3-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220830104833.34636-1-joey.gouly@arm.com> References: <20220830104833.34636-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 70ea9d8d-1b35-4d0d-8dd5-08da8a75450a X-MS-TrafficTypeDiagnostic: AM6PR08MB3416:EE_|DBAEUR03FT054:EE_|AM9PR08MB6999: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: dOCUf1woTXJhXjBgJiTe7nFPReLFkNF8YSUaFeE8HSRMGcqG7Y9bvIRGmUcGKkp9Iib50h31nCye+wSR34IWOCm0rdHrlDux554hcnDLUylxp9KK6cu0T77P52rzUnlGf6CD/y6Dx80H5Xc/FDYUfpnPA38s6xctlVTm51SPsdYHqewVBANzs93gd1RcctyyHug8KLjQkCy/xJTMGe6qYK2oHRKjWbpOA9ks6DE9uHVbT5VCuKtFZMxH7aiLj2pcYMHGzPbCzQ0py4MOj+sp+pl5UbBGFXNt8yvX5BJ6lm0BqptBZ2WRPSSxfkf63MepgtzKuouU4Xfg2pVlIlC8T/Nf9kz9izk0Xikw3L410RrEYhKzJdwPU3XR6ttCT9efd6fKKo5jByMd4Ju0L4A5K0uX+HqF5r8IIVXV/Td9wlAgAg/rN5SuuE/67n+2B5d6o/Urxl/jtuZDC+gs0e/1M990lb9+45x5TyKHSELGgUXavpifvBla2/3Id+ijv5Ac7qmbM/8w2Ln7de2oSufz/DhBOZ3pWNIpMFtcPGeHrjglIwss/1lFblPiTGRQl4ZRUy6NYIQUWwYg5Ii2RfxYi6nEHUXdzPEXapryLlib7ts+jRcoqqsv3uA+rLLJjWH5Sy6A5pCqTZjY1PooaUCXaN2x9Px4vCSyfZVyfsr6u8Ew3sI6mzq4WBVn0xXMHE/2D+T/eV0EbmihcV+rmamkr5fn2RE/yiDbkgM8NkVIop0HABT6ls6tNs3eH8YJjvJRYRcM59nxWdoYJEd4GM8iD/kTScAzulEna451gEoYr8NcZ+8zRiPlFdIzSLWlrGXY 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)(376002)(136003)(396003)(346002)(39860400002)(36840700001)(40470700004)(46966006)(1076003)(2906002)(426003)(186003)(2616005)(316002)(5660300002)(336012)(41300700001)(83380400001)(44832011)(8936002)(478600001)(54906003)(6916009)(8676002)(4326008)(47076005)(36756003)(82740400003)(70586007)(6666004)(26005)(7696005)(81166007)(82310400005)(356005)(86362001)(40460700003)(36860700001)(40480700001)(70206006)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3416 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8046c7b9-5c4a-4160-c688-08da8a753e5b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sGzlOpW+xWScIGgP/2SUrx4zHvlyy3fidHcAwUvN7PSRpr/BQZA0Tn49gFfmtJ9WbktCKyKPh6pKNCtJUCMA1KJG2Wmr1zKdlUV5azl9WxIbTSNI6PPJ00xdlzB7eJob8TxDb/jANyIOwmDfRpdpIwk0vKo+ppNpBzvj8SlIGH/v/FOFvuBqLSCNHkMt0FM1x2mx8tvp5YN1ysoqrkw4/gh8YMTbjIRBS8vo2XIHwus1kkeBGiH3rQImxWAcZrPXGUt1A4rzMxx1HdxELvABd0UriQA4Wgqzomo1ub+yiJ57gNDYsPrsUw0gasIaqUYUOB8GAihRVP+YEADZRICf86nHwSc9+n/2VfOoqK7xhkO11ZF7//6k15246U6aAw+rZLUcHWrYe5fAQ1A6oqqE4CYJQwMnVxL0HSynr0OlsjJJ4wVNnRiE1VYp6vBcV2pea7gFu5gcgg8tQ4pjbsNpZ7FDn/IMMuvndDL5CyGniY1r6sagcVblX99DyE27jC5ddkTo6vu7dqvW4xvmMLh4rIGF4zQR6s1yfwWY0fz/ULeewvLAnZ5rVbmLLT0XgJEToKTxlZAWUquJj6OrhlmcvxH/hO/A3qzQnCdesYKyXIoxQ7aNx0TGWoTdlnOQ3HUJOd/izdC1Kv0RGg4GA3RxJ5KzioB0BujCg4Vy6HipB7/m1hc6Y0IIbkTvFfkW4SmqzviN9EEsjZdQxIirHpZWZhnpYO3QTlDo1isZM1IOyoKHoyCdh5rVlOMH4yzY7wce+bobFbOeeEgAxqdBO/ADnQ== 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)(136003)(376002)(39860400002)(346002)(396003)(46966006)(40470700004)(36840700001)(1076003)(47076005)(186003)(2616005)(316002)(6916009)(107886003)(36756003)(44832011)(7696005)(26005)(83380400001)(6666004)(336012)(2906002)(426003)(86362001)(82740400003)(82310400005)(4326008)(36860700001)(40480700001)(8936002)(5660300002)(41300700001)(478600001)(8676002)(70206006)(70586007)(54906003)(40460700003)(81166007);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 10:49:10.0472 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 70ea9d8d-1b35-4d0d-8dd5-08da8a75450a 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: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6999 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220830_034918_178010_3C8284AD X-CRM114-Status: GOOD ( 15.00 ) 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 Acked-by: Mark Rutland --- arch/arm64/include/asm/vdso.h | 3 +++ arch/arm64/kernel/alternative.c | 28 ++++++++++++++++++++++++++++ arch/arm64/kernel/vdso.c | 3 --- arch/arm64/kernel/vdso/vdso.lds.S | 7 +++++++ 4 files changed, 38 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..a97775963f35 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,30 @@ static void __nocfi __apply_alternatives(struct alt_region *region, bool is_modu } } +void apply_alternatives_vdso(void) +{ + struct alt_region region; + const struct elf64_hdr *hdr; + const struct elf64_shdr *shdr; + const struct elf64_shdr *alt; + DECLARE_BITMAP(all_capabilities, ARM64_NPATCHABLE); + + bitmap_fill(all_capabilities, ARM64_NPATCHABLE); + + 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, &all_capabilities[0]); +} + /* * We might be patching the stop_machine state machine, so implement a * really simple polling protocol here. @@ -225,6 +252,7 @@ static int __apply_alternatives_multi_stop(void *unused) void __init apply_alternatives_all(void) { + apply_alternatives_vdso(); /* better not try code patching on a live SMP system */ stop_machine(__apply_alternatives_multi_stop, NULL, cpu_online_mask); } 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*) }