From patchwork Tue Jun 6 14:58:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13269352 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 66621C77B7A for ; Tue, 6 Jun 2023 15:00:26 +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=eZXFnqr10jetJSNvq4GQZw9zKruY2w07wUUfeSHC3w0=; b=fZ3fMd6CGegLNF aCW0U6hJHFkFGsl20lQUgzPcJx5iM5edlbCE72pQoOFtqAKFgMtBXv0cXbpw6Bp6Pn0ZFjHX6GOAv rSP4Qj5Vann8/N+8nTf/7A+IXpo2wX312x0XGYJtMhx7kvHADWQhJ9HV17lrIbByWGIP5Bfl5kKSU Nkt5S4ktFgsXC0CjhdQT0UBtAdQ9J2jGct5bRWpX9rkAk1mLdN69feDVxeW9v2PuI0EiqlQPB9hfn PltR2vM4kJkqoGGt60Tk1sdQn1QKABTctMCVwAuWNWUpxmMCX0RT/H94zW6TccKzJtXzzfMwlRfEi D9cFs+okL8bebQsptKSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6YA1-0028rD-0f; Tue, 06 Jun 2023 14:59:49 +0000 Received: from mail-he1eur04on0609.outbound.protection.outlook.com ([2a01:111:f400:fe0d::609] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6Y9n-0028fA-18 for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2023 14:59:37 +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=1TnyYVkw7n8Wc8GFE4nFlzKYeqKDxRQjUxf4WgUmQ/s=; b=vLA6dUAWSh4QzeIxFxnIKKLxfFGcvnNV4hyqcFjFs5TUuB/xmO3u8XHlOMvnYyJ+db054z9cvqC5opBL4aL7t83cdqYvZE0igTWwXod3d5IpidKxPzQa45emFctJ3OTbo7Mo24XUXlW64hl4SLSUuU21OpSLMYX8d5dGnqcyrSw= Received: from DUZPR01CA0104.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::17) by DB4PR08MB9862.eurprd08.prod.outlook.com (2603:10a6:10:3f1::18) 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:29 +0000 Received: from DBAEUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:4bb:cafe::a4) by DUZPR01CA0104.outlook.office365.com (2603:10a6:10:4bb::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32 via Frontend Transport; Tue, 6 Jun 2023 14:59:29 +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 DBAEUR03FT047.mail.protection.outlook.com (100.127.143.25) 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:29 +0000 Received: ("Tessian outbound 945aec65ec65:v136"); Tue, 06 Jun 2023 14:59:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2cc761184f17fdff X-CR-MTA-TID: 64aa7808 Received: from 1b6cd0967af9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AEC21736-9809-48FE-95CD-B507E02B4465.1; Tue, 06 Jun 2023 14:59:22 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1b6cd0967af9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Jun 2023 14:59:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hrOxM369Wk6GoK23+c79KkXsDNiMbVIWLQuZG2p2tXVLh1i7p9fI7reS0fyxL3WZPFRK3g7x3dUDunzdgLPOEORON68cDbz+0kWr26cNHsFnlRRvoSk+CmWGJT/4yq5z2C3cOpFwD3DkFqYG8JIhjNyD/kc+6ER/evQ6rMvmavlEjhCuqeXXtvb280BWuDswaDeNMiTEg7oR3JuAP7Ey8alSQAfYrqbZt5eaPoktQmp61OggUrXcneoF4mjuI1Hl3cjtFatO9RXLDLiqplin03fVCJK/l9QVj3g4Mch9DJVXHrAcO+sRM/i7n/aChwbRV3wTbc/Ao2KuxWZ2JiTxZg== 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=1TnyYVkw7n8Wc8GFE4nFlzKYeqKDxRQjUxf4WgUmQ/s=; b=as2tKg8PM4mX5qw/mdbxuZ2m1tER/zK6fx6act/GA73RAgX7jtt0RLIUrOax5gTez9i4RaFN/qgvrKbATufHJ2m/wc1CHZah2053HfuToDK/WRb6YnwLWXsDkeK7uj5e3Dlk/FkGfJcsgjXDYwXXxCrg6+hIjiPO69BaN+KoGw8bcB6IhNiolYZky4Gves+XoesGeSdZk7TWKHH259BM1b14JZNRokFbOfb6CvAV7algFFIPt1e5TIJhW3iGyWEyUtaD9Got4Nkji0by/SoFwk5k/fwhFfAfbI7/lNi/6YMBGSrYadXlY/rFHANY9KMer4MFh+vTyENE65OcN1i6rw== 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=1TnyYVkw7n8Wc8GFE4nFlzKYeqKDxRQjUxf4WgUmQ/s=; b=vLA6dUAWSh4QzeIxFxnIKKLxfFGcvnNV4hyqcFjFs5TUuB/xmO3u8XHlOMvnYyJ+db054z9cvqC5opBL4aL7t83cdqYvZE0igTWwXod3d5IpidKxPzQa45emFctJ3OTbo7Mo24XUXlW64hl4SLSUuU21OpSLMYX8d5dGnqcyrSw= Received: from AM5PR04CA0024.eurprd04.prod.outlook.com (2603:10a6:206:1::37) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.31; Tue, 6 Jun 2023 14:59:16 +0000 Received: from AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:1:cafe::2) by AM5PR04CA0024.outlook.office365.com (2603:10a6:206:1::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32 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 AM7EUR03FT034.mail.protection.outlook.com (100.127.140.87) 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-EX02.Emea.Arm.com (10.251.26.5) 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:08 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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:08 +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:08 +0000 From: Joey Gouly To: CC: , , , , , , , , , , , Subject: [PATCH v4 12/20] arm64: add PTE_WRITE to PROT_SECT_NORMAL Date: Tue, 6 Jun 2023 15:58:51 +0100 Message-ID: <20230606145859.697944-13-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: AM7EUR03FT034:EE_|AM7PR08MB5399:EE_|DBAEUR03FT047:EE_|DB4PR08MB9862:EE_ X-MS-Office365-Filtering-Correlation-Id: 87dde845-6028-4edd-fc61-08db669ea0cb 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: oMmMdsEI2hHJyo47MfMnVCJ0lnfwi7Kr1B1EMse31H5fSwIyPhE75ICfFfL77ePB/nUpnpC6x09Pm8YvH6CAbNqtmG3WgjwZLHLBJ98cOQWcsRnMu9R2ySw0i6VzrzK0awPmXpMXspeYjEE2ml3IOrBe3gyBZlNW4uZ5glcYNR+x4+ad7jP4nroqC4ow84WRSvnk4prEEafYL9rGjxSdqkp2Z6O3RT6peqO6JhKE/cgoth4p+cO9DpeRFajZyYwSOYtMr4VHoI3+iD07REjtotV3v+aH8sYLgW+5TqUIgW2kt5z441Og2L8ubPXsbet0IBSGT07oquintcyln4tHzNdGnvAPwIr2UdmJhIPc4+9b4Y6wQ1TWiUqQIEUxtxTvh9rM3xg5r4N84v9YDbndm44GNmIR0AdCxsBxtqIV6xFSFQXPfC6OQbYDLGV9HQmsfBHOYMKWA7flhc5AwoQLrn118ycLOHap9+LJcbvsVqX2zZMW2Goh+8igGUzgLR2Q8Eg659lZ7xG5jxM5XFmAI/aNgXYCWAfGkjmhXaYOdGm86sA3iE2MbECeKXOaB1c8JvOTMzfe0uF8icOkp/Bdj/Ou2CvU1IesvO7MOqQ+gX2cXGVZXGHTDJM8kLDaKAx1ZIa0BB1QyckBpVGNJ4L28GAD6U+J6whhMAl0WCOsZtKBDW4ikwmpFt2qPvk79mtrDqATOOjOOp1I5qkvES9F1Lvs03Rbt1VL9We9xEUf7CXn6R8DAvD1FvyJluWQA9pF 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)(376002)(136003)(39860400002)(346002)(396003)(451199021)(46966006)(36840700001)(1076003)(26005)(36756003)(81166007)(36860700001)(47076005)(336012)(83380400001)(426003)(82310400005)(86362001)(356005)(82740400003)(2616005)(186003)(40480700001)(478600001)(2906002)(41300700001)(8676002)(44832011)(70586007)(54906003)(6916009)(70206006)(4326008)(6666004)(316002)(5660300002)(8936002)(7696005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 01c8bdc5-d21a-420f-7269-08db669e9978 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vzlwmfg64n5uxOeA8Zb7gTsyZKsN3qSP8bXiGGMUBNo/JFigpzq0bqsgTKgPu7kRZfeWDc3OrFF74ys/3CJIomiAN3iuBX8VaviWG+rg9jLkeQeF/HHBWgsQtqG3deN73Byft9kiBBrTMlSXkVeu++0SnEiBFuLNb9do4aEBJFDqPnvgV53woJ+tHGnhgUBzzkGJPw4aPO7SQSGruA86D4REH/6b5TuniVrKxOB6T9OPP3P0rqjUWtHRX6hSK5vMHERUp+y1UnKCRTAHV8yA8PfogaAxo+lTY4CjGqsmxs5yVWB60vitmAvkuVh4qZyu6lGzpiXpw+Q+evODr9SrnWVOvCY65wGHAWYWABD4ds+XSGnEvIRlgLJiwwYBxKIkaGTS8f5Py56SrsOSusgx/GjDmi+s/muySfWOEeSWEldR5eFsTGWv2fKe67TeRBZcHqWWNbh5wrpdj180VziLQFyHbmvujNhhwwpcYFPW2vZXL0901Mh+2TRrxvCXPpdCqLKeNr7CHH0WX9K0v3iB68uruVFKlEMtLikx1PULFLUF80Yhq8MJzty6B7wQoTZUCRbf5y8qJj6qUhlhd4x4Ox9eSeQ92DuP/KIZqnrfa/7rb0Cdzl7tt0Hlm+aHtO3uqHenHFFkVdQQhjMacy6/gLxnQmNeJQX3KYS6XLv7wboR+81SttG2QyOcXyzx/eJI228yfVbWhtwwSnyYfnlamvdwtINuWE3TbqBhY1NCIieRmEphpSzzgpzJwQkYLser 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)(346002)(136003)(396003)(39860400002)(376002)(451199021)(36840700001)(46966006)(40470700004)(26005)(1076003)(40460700003)(107886003)(40480700001)(36756003)(36860700001)(47076005)(426003)(336012)(83380400001)(86362001)(82310400005)(81166007)(2616005)(186003)(82740400003)(8936002)(41300700001)(44832011)(54906003)(2906002)(478600001)(70206006)(70586007)(6916009)(8676002)(4326008)(316002)(5660300002)(7696005)(6666004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 14:59:29.1489 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87dde845-6028-4edd-fc61-08db669ea0cb 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: DBAEUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB9862 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230606_075935_394606_82311079 X-CRM114-Status: GOOD ( 11.07 ) 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, PROT_SECT_NORMAL would map onto PAGE_KERNEL_RO. Add PTE_WRITE so that this maps onto PAGE_KERNEL, so that it is writable. Without PIE, this should enable DBM for PROT_SECT_NORMAL. However PTE_RDONLY is already cleared, so the DBM mechanism is not used, and it is always writable, so this is functionally equivalent. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/pgtable-prot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h index 9b165117a454..d26d0b427c0a 100644 --- a/arch/arm64/include/asm/pgtable-prot.h +++ b/arch/arm64/include/asm/pgtable-prot.h @@ -60,7 +60,7 @@ extern bool arm64_use_ng_mappings; #define PROT_NORMAL_TAGGED (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_TAGGED)) #define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE)) -#define PROT_SECT_NORMAL (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL)) +#define PROT_SECT_NORMAL (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PTE_WRITE | PMD_ATTRINDX(MT_NORMAL)) #define PROT_SECT_NORMAL_EXEC (PROT_SECT_DEFAULT | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL)) #define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))