From patchwork Thu Apr 13 11:05:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13210142 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 40E80C77B6C for ; Thu, 13 Apr 2023 11:07:00 +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=TtlK3sMHLlfo0y DhPR5ryYLJQPZH6Y1gzecuKeCvfrI3emYJscCrzmMsk3EZ7+z3+vL2OD//9K/tratPVupqK19URhd JsJz63oz8k/PMakD+ZlqyO3imY2GM/GxRbPGLYvP+VCKzSSOLb0Nm2AaFTJezPsK/6v4RdIFeg4kO 8UsV/4cVrq9sQPfA5dKOnt1tXKR2Iyud+d99Q7oAGZY3IOS43ZUJOFAtraXZZKHbYnUnq1n61CLOo lCkfsdJ65Ei/rp1LXDkgKkz4iWB2w193NZhG+4Eo+OkeUz7M1IJ5eE/K/BizzBJCm5ttFfQBH1ITN GSJBSSCAdsnpE+PzUQxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmum1-005yVE-04; Thu, 13 Apr 2023 11:05:53 +0000 Received: from mail-db8eur05on20620.outbound.protection.outlook.com ([2a01:111:f400:7e1a::620] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmulm-005yKM-32 for linux-arm-kernel@lists.infradead.org; Thu, 13 Apr 2023 11:05:40 +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=SNPXBWgsKSSj59FBHLUwcwzZVEIULH5NnaEYZSwswEwPxL6TxxR8FwvUrMgwppITnZix3BWddel+MvXCeyYVAKCyRe1qysB14KYivi1yGWckT0crlbwYK8VIuT9zo2t0fN6b2dF8If7ntB1j8wTuckJW2ydJaC694eU1NHf/F2c= Received: from AS9PR05CA0218.eurprd05.prod.outlook.com (2603:10a6:20b:494::7) by AS8PR08MB10222.eurprd08.prod.outlook.com (2603:10a6:20b:63c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 11:05:28 +0000 Received: from AM7EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:494:cafe::4) by AS9PR05CA0218.outlook.office365.com (2603:10a6:20b:494::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.32 via Frontend Transport; Thu, 13 Apr 2023 11:05:28 +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 AM7EUR03FT059.mail.protection.outlook.com (100.127.140.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.29 via Frontend Transport; Thu, 13 Apr 2023 11:05:28 +0000 Received: ("Tessian outbound 945aec65ec65:v136"); Thu, 13 Apr 2023 11:05:28 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dc0f0ac27651bcb2 X-CR-MTA-TID: 64aa7808 Received: from 767d7e912c85.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id ECB748BD-B6DF-4CD4-A71E-4438A3227A09.1; Thu, 13 Apr 2023 11:05:21 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 767d7e912c85.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 13 Apr 2023 11:05:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AfA1tBqqTUuRaoQTjLRtyN7tJ4FxJUvYNrmhGs1RTLWZW7+JoGq+VOKInOvqSv/HZTKxWS8SHjkSRm+w9gS5lV7XTNSqBag8SkUtQop46WgNhBI05BSSSVtfYTeC+BvKbERci8F4WlI1gjZfGdL88C7xYlkJP4TJpNOOJxqFjkZW58XVdVcCxIYpOc3mrh167Rnxm/nGrRB3mYZ6B4Caj5guqtEicscnY2PZwUHqFx+0jEs8m0cn9NRKnot6M4aw+lto+2hSz98YzTZZSIE4xSNjr3ljWwTwr7je9XNfgud/Z0uwFehWCWABUlfIORnBowxGRlks2twyLTPAbjR/8A== 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=R6z+vAoGusfK0iltiqOCGRG5lO9VBYwp6iI9q3D3Vdm04SXJyOXdFgiEhAHmzPjDi01CxSAwSHMUyoSQ8saib6yGwCVOQAqNlC38mm+bDLvVc8edGbd0mdbrntEzfMpPDDGSCkpWKqt4FaGwDy7dF+EmpcaSJjxNqtokw8qhVoFfQTnjxJmjzOnLhtYqsSFpAS2kC5xX3ExPqUEVRSvTulCJiMWRzH4ThHmXrrvRlcA+GhqC/kJtUKHqqodxh/XXFq6crezwIbXa4eH6JmR3TczkmADuz2Lq8mIh7Q5DckTzKnEGAsyEpmTwL/gUwZj3qxk8uUsk8gInZw/1tIKozw== 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=SNPXBWgsKSSj59FBHLUwcwzZVEIULH5NnaEYZSwswEwPxL6TxxR8FwvUrMgwppITnZix3BWddel+MvXCeyYVAKCyRe1qysB14KYivi1yGWckT0crlbwYK8VIuT9zo2t0fN6b2dF8If7ntB1j8wTuckJW2ydJaC694eU1NHf/F2c= Received: from DB7PR03CA0095.eurprd03.prod.outlook.com (2603:10a6:10:72::36) by AM8PR08MB6402.eurprd08.prod.outlook.com (2603:10a6:20b:363::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 11:05:20 +0000 Received: from DBAEUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:72:cafe::64) by DB7PR03CA0095.outlook.office365.com (2603:10a6:10:72::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.32 via Frontend Transport; Thu, 13 Apr 2023 11:05:20 +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 DBAEUR03FT020.mail.protection.outlook.com (100.127.143.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.31 via Frontend Transport; Thu, 13 Apr 2023 11:05:20 +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.17; Thu, 13 Apr 2023 11:05:19 +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.17; Thu, 13 Apr 2023 11:05:19 +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.17 via Frontend Transport; Thu, 13 Apr 2023 11:05:18 +0000 From: Joey Gouly To: CC: , , , , , , , , , , Subject: [PATCH v2 12/19] arm64: add PTE_WRITE to PROT_SECT_NORMAL Date: Thu, 13 Apr 2023 12:05:06 +0100 Message-ID: <20230413110513.243326-13-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230413110513.243326-1-joey.gouly@arm.com> References: <20230413110513.243326-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT020:EE_|AM8PR08MB6402:EE_|AM7EUR03FT059:EE_|AS8PR08MB10222:EE_ X-MS-Office365-Filtering-Correlation-Id: 45d0c2e1-42de-4876-6f9b-08db3c0efda8 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: NTY7Fbksxj1/tOl9JokOuUfdVAU9pe4ETkrrKyivrcHgdepuvHNegQ4rcLB+zZT/esbCxzskBUgJQiZIG06jrys52YQYTtp1Af0Uh7kkpGd8apyOO8h6flJ/VxeAvb3+rHIfy80nMC4u9uEERdzEDbHE5uh0CTiPoP2qAwCFGvtWB5QQ8PoYB4ARNKmmk4cp9TNprlbm+/C/q8fZ6q18wxtV3lezEtFQpVD59XQMxQURrdjIf/YAh5TcMzFfR3yyHmYcI059Jybj6ghSOhAe/5a7XLI2TMoT56IVmxUwNvehUttqCuiC1InMIH7sxNwdfbI13H/lg+8sfsDXHj1FwWuClvgcei9XV1sfWglUxGNPZo09+VHgBY0NE6mCFN8/6DOhUP4jlfNYf4IojCHLrDKz4UafFTqd8jZcbXs5tsFbkoOcMLiiPtnOR5o4rBG+vjAmvyVua8zTTAE8wzqcxaBzkvAhwMrdNqXeQyKL3Jxhc+uaKdRV9isE32dupek4IeyC9Xyx7ocwWjkP5K0BGYV2eCb4bbQ9Qy4D1lkAldRJHPUZXidWKyAJUn5eavdZ+8V9XLwBKHzpbbySLF+CffeksXkXtffnHPhRIL8mNCoWf7D3yRT7Q4ML1mu/fB1khE2bOLUA/7coE5UiPz64O+mulL/cmn10VZKeQQBXLpjTs3W8t8U3lW+AocjU69WORvcj54xXJT867gTLuvv4UAWv/GqxwKQQp81sg+ia90Y= 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)(396003)(346002)(136003)(39860400002)(376002)(451199021)(36840700001)(46966006)(40470700004)(40480700001)(1076003)(4326008)(26005)(186003)(40460700003)(316002)(82310400005)(8676002)(8936002)(2906002)(86362001)(36756003)(5660300002)(44832011)(54906003)(6916009)(478600001)(47076005)(36860700001)(83380400001)(426003)(336012)(41300700001)(2616005)(356005)(82740400003)(81166007)(7696005)(70586007)(6666004)(70206006)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6402 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4d65c924-a5eb-4ae2-2571-08db3c0ef88e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6b2EdYguPMpeun9edJLa/t/wjbDbtUtqKcs0QXt0oGry02MS2YAKM6MhJ5q0JkKPrHaQhCh1PRyv7N712lwW0E1WLj/objHb6/i62XwoK8WfUWQ7QBAjIHJIqNB3Eso6PG3vjUjfm2nBLL0VjGoBy+5t4Q371zMIMgRmyxXwJw1qYblz7y9ps7ew2PoS+qQrwEANca9RvYm66tW+nksgw2gJm2MafIZ5xjPV01/MogZoI81SIc3ed7VSZkFlpk+NmyXMM4+nvKz+qAdHDZbbPxRtRa9WzVftUqwmpBMuti5oCC1qzjkwYmv8Wz4LkoLdvgB7wwRKS0WrrJSaDAvNSh0JzCb5h/syJ3jTe77giBUi/U28h0937FJ4ex8nTDkbCj6TaF3M83bI0/D+fu+lWHzi/iSQaT039D4QXVnY0DcrjMzSTzNpS+9tETj6Y9mEGj2D3Agv2bH7DuxeL2TfA5GBa8JF+RJHQOt41Z8RDHFVtcFNGSdV55nCu+5jhSs9uTyaUZoDKeBl/Tzh9Px6StkuRUHA9pTzwKF3AQigUTJUbjJLASdmnAcuDXTHEf8dGLfclzUXsuQ7sEMLDH3QcrgJtS+rGBoLvitPOvFA1eo3sapTIisWaiwdFjsZk1jgjh2EabywxbTOMpT68SStSzXxHRa2HZdxB1E5Qrn9j4v7uiBlcFZbRORlTEuFkpl3bezqXl2sFm/DH3L6phHLMQ== 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)(136003)(396003)(346002)(39860400002)(376002)(451199021)(46966006)(40470700004)(36840700001)(36860700001)(5660300002)(41300700001)(82740400003)(40460700003)(36756003)(2906002)(8676002)(86362001)(40480700001)(4326008)(6916009)(8936002)(44832011)(70586007)(70206006)(81166007)(82310400005)(316002)(1076003)(107886003)(2616005)(83380400001)(336012)(426003)(47076005)(54906003)(26005)(186003)(7696005)(478600001)(6666004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 11:05:28.5471 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45d0c2e1-42de-4876-6f9b-08db3c0efda8 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: AM7EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB10222 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230413_040539_021490_22C6E7FC X-CRM114-Status: GOOD ( 11.04 ) 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))