From patchwork Tue Jun 6 14:58:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13269356 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 81C31C7EE24 for ; Tue, 6 Jun 2023 15:00:33 +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=sBh1JYjmz/0yxDLUpvcV2JgHfDddmMBArYyGbNnjDFg=; b=1QQ97Y/EWaVlux Sa7AXA+EpeCB8cr7OOSXOBEcrOwamPhYTVFMNbxLjzI7w6I5ESNHfhIGyas/TWdkj/qJH5vrFYo2Q Hx3fxShAw8fKUPXpUwE5wEa9ZKaSRe6uoZ3H5ulZE4pkvijXfEgP7mjTQMaaSXj8jkGQ5qDWw6/7Q fxS0xWqxthD+1iH+YYVg/Y7YBYrdKKVHB4o3A26hcRZONnhFIeFQe4D4s2EsuEx2aE62GAI6t2Q86 4s165veboKsDBtOMiXxum9WGdEdBM+jYHEXjCcdEzuKjjTGzVO4e2Srt7dt8sFAs22fySr/k3niMc 6G0w1gK9pXU6mwtmVxyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6YA6-0028xH-3C; Tue, 06 Jun 2023 14:59:55 +0000 Received: from mail-dbaeur03on2061c.outbound.protection.outlook.com ([2a01:111:f400:fe1a::61c] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6Y9q-0028i0-0x for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2023 14:59:42 +0000 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=e1GGR6lFpaNRU9jBTjWAXNM74PvL58UZ1KY32+E21TY=; b=LeqXqD9y7y2GH/oIxLgvC+PvGOau9iQ25vkHc7Y5urHFy/XnS8TTvllOIKiJc4Oi4/1Br/dVEhHhHFolTdZFGIa1qrQ3iMsD2LjKERZwzdovVQBbrRjwPXdNQLMaBQLGSvFzd6LrkDqKqNGNUX8w/TRIREXx6A4C1lfAdfXSqeI= Received: from DB6PR0601CA0038.eurprd06.prod.outlook.com (2603:10a6:4:17::24) by VI1PR08MB9957.eurprd08.prod.outlook.com (2603:10a6:800:1c2::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 14:59:27 +0000 Received: from DBAEUR03FT015.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:17:cafe::e8) by DB6PR0601CA0038.outlook.office365.com (2603:10a6:4:17::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 14:59:27 +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 DBAEUR03FT015.mail.protection.outlook.com (100.127.142.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 14:59:27 +0000 Received: ("Tessian outbound 99a3040377ca:v136"); Tue, 06 Jun 2023 14:59:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 770d426bc666f38e X-CR-MTA-TID: 64aa7808 Received: from 3ef26d77bec9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 60CC1508-473D-42F9-AD91-2342C1BCFDFF.1; Tue, 06 Jun 2023 14:59:20 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3ef26d77bec9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Jun 2023 14:59:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EgxRFQKQSP1EhPLVxk+cpfl7x3P3n0EjPDayd4LnG1lNSj+IN9CaKVeI1OiRCTAs5OhDZ5h3QYtNoQkqDDruR0aF728thR2BlFZpWsnz/450t8WNp5yJXsEWyO/+p81nLOQl0QRE01ApBJFxXuuCAbbhWe0fEIoHj1jZCr2J05lfd0TDkIuKf13L7iJT50le/VbqLVrJ5NKwjfzs4Uw4uh2XH0l3Qw6UqHzUPe8ftNJ4vAvU91T6mGmzEi8nrTbSl6q88povVzJdMULf3WHHKdbP1m7S/uA1sUV0d3VU99Vu5AHUwtrYV0uime8i1GwD99UnhH9wprALZToBuu2lUw== 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=e1GGR6lFpaNRU9jBTjWAXNM74PvL58UZ1KY32+E21TY=; b=EkW7R26U1+LpBalfT6Ixc6/AiMKFy45GvWWxYo4Ib7QdPrfKRBF8YdjgqaS3Gefm4hOjRqwx85JBbS7aGyQDvOxYc43T6RApKHYoSsF+WGIx4oAVzOBEUe747PYrn2P4ueogyd4wIDqBKfB8qUmDRnpXccJ9GbhubwCIBn82YqpLNS1QqcFC5YlObY2wOeby8m2u2kcLHHhzgKxoti73VxiWlcJJRncbU95LiRzBAVfEroEUSzo5677oU8OZVHtjxbEpppNtXZMoKcbL1FYxl5qFZGNckVHYAaDBjkah+/LuKnZsNt3O5SbizqJdbJ/hLfJBCfrjIrZz7mE/1zvSlA== 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=e1GGR6lFpaNRU9jBTjWAXNM74PvL58UZ1KY32+E21TY=; b=LeqXqD9y7y2GH/oIxLgvC+PvGOau9iQ25vkHc7Y5urHFy/XnS8TTvllOIKiJc4Oi4/1Br/dVEhHhHFolTdZFGIa1qrQ3iMsD2LjKERZwzdovVQBbrRjwPXdNQLMaBQLGSvFzd6LrkDqKqNGNUX8w/TRIREXx6A4C1lfAdfXSqeI= Received: from AM0PR04CA0007.eurprd04.prod.outlook.com (2603:10a6:208:122::20) by PAWPR08MB10318.eurprd08.prod.outlook.com (2603:10a6:102:331::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 14:59:16 +0000 Received: from AM7EUR03FT017.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:122:cafe::37) by AM0PR04CA0007.outlook.office365.com (2603:10a6:208:122::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 14:59:16 +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 AM7EUR03FT017.mail.protection.outlook.com (100.127.140.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 14:59:16 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 6 Jun 2023 14:59:07 +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.23 via Frontend Transport; Tue, 6 Jun 2023 14:59:07 +0000 From: Joey Gouly To: CC: , , , , , , , , , , , Subject: [PATCH v4 11/20] arm64: add PTE_UXN/PTE_WRITE to SWAPPER_*_FLAGS Date: Tue, 6 Jun 2023 15:58:50 +0100 Message-ID: <20230606145859.697944-12-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230606145859.697944-1-joey.gouly@arm.com> References: <20230606145859.697944-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT017:EE_|PAWPR08MB10318:EE_|DBAEUR03FT015:EE_|VI1PR08MB9957:EE_ X-MS-Office365-Filtering-Correlation-Id: c89c7840-99ad-4d80-549c-08db669e9fec 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: etYqsSWjLCr91Aj/o53BKkiqUTcftNZSb2gzaPCB2aFJpGQ92MiK4GgZ5KgMThCJINTKNUSQBq0su5LJeStAl6AvNwENqrvPUfttPauokAVWjzsQA3RzBxLP8mOM/4+LoN9+KH9/3PhyX5PxM06MUofaTkEduWs2tyYLP1cnNHodkH1zHAaGouLdqJ5QnP1gm1/h1f3vaikA4LxjBqEhhP2sZKCUqYCEjI0s4B6nfXUWn3+EX1GqhcshIMapOMcUDpMlLaS/pB/UEBh404S27JmP2FvI7GYNvTXE9fdPhgmXeyO3EVR7HqT+Ubg4giD6/jPRg/ef+Y1bVkuMdEMtnBGHb17IEQkVBm1rcn3EVfjzucKFc06vjInuGYVavWLzAMkabiGQOCg1qDBR6K/lZB3YIhyAkz6QLYj6ieYiiy6b01vbzO2rY7Rmc5ywvS9iNHw7UD5lLD7ziSP4Ud8NY8Y5KWz0R9+5suCefAgacAxRFMWZnATkNqDn8lAF2PQYjvFr/tlK6QCMcegrumQpC7gX9e0ChS/fZMC8odYe9Ryy7ptFiK5SU8es+wa2SsyWH6aNFwIHTNc1f9ZgbgO+rCCZ0ccxftEv8VCqJ+iqV+lnWFiyNu8LSUuMMjxuvDkncEJZM8o3qDLxj9msYjJpRfujMozfRwQ0DswoJBsw9ZNlT9Wjl8m06F2yIK+pDWVADOMTg5nbHXOX5n8rJTKcngdvPlJMTrOZiDegz8G6qzP8sx5LyNA44tpfnm7ghbefI9KKxC2SH1g4nRI6tTQJRw== 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:(13230028)(4636009)(136003)(39860400002)(346002)(396003)(376002)(451199021)(46966006)(36840700001)(40470700004)(54906003)(82740400003)(478600001)(40480700001)(8936002)(8676002)(44832011)(5660300002)(36756003)(86362001)(2906002)(6916009)(4326008)(82310400005)(70206006)(70586007)(316002)(81166007)(356005)(40460700003)(1076003)(41300700001)(2616005)(26005)(36860700001)(47076005)(83380400001)(186003)(7696005)(6666004)(336012)(426003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB10318 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 170e71f7-5a72-4bc1-6c63-08db669e9944 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r6pWVTeNIW/CPMBIda2d5A/EBTZpPOXz8J3stUIoUa78jyzD0+HEttdBKrdxnOBSfat3P0kSQDwq6NuDr1NmzVBWckxSi4DX76eqgxwfah6hlj11EK91Gn4oGH0bzozUTEe7jH90fex848RLmbTwV2n//G+O76ZvndY4FUc5EcuV1osmAqP8Tq5mQeoSepDmXU7jyWrQGee3B64ZopX2iWf/W2bQRfcIzE/pwtDIRBcUve7Ufw+vKbtqdFpz3A1mmFRRo0+DcgqWEeJZC/le/1uCkDpSRQbk8OhEWoUF6ci6B6p1tk+WniDXOXQ7cTpxcHTtSp765i23OwEvmb/VkY/lhK4xVX1kCc/1qpN1VCqmQeiJt0VC04CfCyAtW+jgORTYuaHL6uC+B1IcoReX9iOGEXlGS9KUeFPl6n7mHoAV1erjpx5NfAHHI+29MnzElbwxxCykPzVkJoCLi9ThEZ1If6Hl1Qjij+nGnPv3uKrdiQJ9elxW7Wc+t0dvRDRZB8iVI9nIBeCTSUrQ7z3oe54xBYIULW4a8tiBykF9KEiwCz/hPNgH1ZAqd8gU/6Mxg19LNPb8H0g2ZSjaLSuIyTsxqMRAp00Z7qyh4e6/juh/PfsrFnuyKBnH+euHavrGpkSpiBiu36WeIxu5W1e/T+YropJpOYjvXi3nBmr/vBQ+faAeBvyQRmtqjfNXNAoU9brTcUldhK0WlgyClXyjv/anB4yziLxbnKod/inSapMoU5FKQspGGpvd3Me7HRXu 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:(13230028)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199021)(36840700001)(40470700004)(46966006)(8676002)(4326008)(44832011)(8936002)(70206006)(70586007)(6916009)(5660300002)(316002)(40480700001)(41300700001)(54906003)(2906002)(478600001)(40460700003)(82740400003)(1076003)(26005)(86362001)(81166007)(186003)(107886003)(36756003)(7696005)(336012)(2616005)(426003)(47076005)(82310400005)(83380400001)(36860700001)(6666004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 14:59:27.6519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c89c7840-99ad-4d80-549c-08db669e9fec 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: DBAEUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB9957 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230606_075938_531210_A5E7E6D0 X-CRM114-Status: GOOD ( 11.91 ) 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 With PIE enabled, the swapper PTEs would have a Permission Indirection Index (PIIndex) of 0. A PIIndex of 0 is not currently used by any other PTEs. To avoid using index 0 specifically for the swapper PTEs, mark them as PTE_UXN and PTE_WRITE, so that they map to a PAGE_KERNEL_EXEC equivalent. This also adds PTE_WRITE to KPTI_NG_PTE_FLAGS, which was tested by booting with kpti=on. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland --- arch/arm64/include/asm/kernel-pgtable.h | 8 ++++---- arch/arm64/kernel/head.S | 8 ++++---- arch/arm64/mm/proc.S | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h index 186dd7f85b14..577773870b66 100644 --- a/arch/arm64/include/asm/kernel-pgtable.h +++ b/arch/arm64/include/asm/kernel-pgtable.h @@ -107,14 +107,14 @@ /* * Initial memory map attributes. */ -#define SWAPPER_PTE_FLAGS (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED) -#define SWAPPER_PMD_FLAGS (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) +#define SWAPPER_PTE_FLAGS (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED | PTE_UXN) +#define SWAPPER_PMD_FLAGS (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S | PTE_UXN) #ifdef CONFIG_ARM64_4K_PAGES -#define SWAPPER_RW_MMUFLAGS (PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS) +#define SWAPPER_RW_MMUFLAGS (PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS | PTE_WRITE) #define SWAPPER_RX_MMUFLAGS (SWAPPER_RW_MMUFLAGS | PMD_SECT_RDONLY) #else -#define SWAPPER_RW_MMUFLAGS (PTE_ATTRINDX(MT_NORMAL) | SWAPPER_PTE_FLAGS) +#define SWAPPER_RW_MMUFLAGS (PTE_ATTRINDX(MT_NORMAL) | SWAPPER_PTE_FLAGS | PTE_WRITE) #define SWAPPER_RX_MMUFLAGS (SWAPPER_RW_MMUFLAGS | PTE_RDONLY) #endif diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index e92caebff46a..0f5a30f109d9 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -382,7 +382,7 @@ SYM_FUNC_START_LOCAL(create_idmap) adrp x0, init_idmap_pg_dir adrp x3, _text adrp x6, _end + MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE - mov x7, SWAPPER_RX_MMUFLAGS + mov_q x7, SWAPPER_RX_MMUFLAGS map_memory x0, x1, x3, x6, x7, x3, IDMAP_PGD_ORDER, x10, x11, x12, x13, x14, EXTRA_SHIFT @@ -391,7 +391,7 @@ SYM_FUNC_START_LOCAL(create_idmap) adrp x2, init_pg_dir adrp x3, init_pg_end bic x4, x2, #SWAPPER_BLOCK_SIZE - 1 - mov x5, SWAPPER_RW_MMUFLAGS + mov_q x5, SWAPPER_RW_MMUFLAGS mov x6, #SWAPPER_BLOCK_SHIFT bl remap_region @@ -402,7 +402,7 @@ SYM_FUNC_START_LOCAL(create_idmap) bfi x22, x21, #0, #SWAPPER_BLOCK_SHIFT // remapped FDT address add x3, x2, #MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE bic x4, x21, #SWAPPER_BLOCK_SIZE - 1 - mov x5, SWAPPER_RW_MMUFLAGS + mov_q x5, SWAPPER_RW_MMUFLAGS mov x6, #SWAPPER_BLOCK_SHIFT bl remap_region @@ -430,7 +430,7 @@ SYM_FUNC_START_LOCAL(create_kernel_mapping) adrp x3, _text // runtime __pa(_text) sub x6, x6, x3 // _end - _text add x6, x6, x5 // runtime __va(_end) - mov x7, SWAPPER_RW_MMUFLAGS + mov_q x7, SWAPPER_RW_MMUFLAGS map_memory x0, x1, x5, x6, x7, x3, (VA_BITS - PGDIR_SHIFT), x10, x11, x12, x13, x14 diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index c2cb437821ca..9513a8d2ce0e 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -199,7 +199,7 @@ SYM_FUNC_END(idmap_cpu_replace_ttbr1) #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 -#define KPTI_NG_PTE_FLAGS (PTE_ATTRINDX(MT_NORMAL) | SWAPPER_PTE_FLAGS) +#define KPTI_NG_PTE_FLAGS (PTE_ATTRINDX(MT_NORMAL) | SWAPPER_PTE_FLAGS | PTE_WRITE) .pushsection ".idmap.text", "a" @@ -290,7 +290,7 @@ SYM_TYPED_FUNC_START(idmap_kpti_install_ng_mappings) isb mov temp_pte, x5 - mov pte_flags, #KPTI_NG_PTE_FLAGS + mov_q pte_flags, KPTI_NG_PTE_FLAGS /* Everybody is enjoying the idmap, so we can rewrite swapper. */ /* PGD */