From patchwork Thu Mar 9 14:52:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13167714 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 02F28C61DA4 for ; Thu, 9 Mar 2023 15:05:59 +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=bBfWuM/h0WqsvtWSNk4g5MLgzg9Omv/4t4tG6irRNOA=; b=gz5axX16S2VK9c IdcNlzLVIfYkl//9f3a+OslKTbSqBhT3WsxX1LjEBlaTq4SpGs3+3whn0sAJZ2gWLMIUTDXE9Kyyf hnI86kcGaeMmuU7wLyDF8yGXe2TwLuGUkY1OE4gwUA+8BcGSaCYJ/bqYMEpBTCqQuV4AXQvczyRPA IapBskPALEfbme0bK5r5NQ3SryytomTyg3zG4PN2HlbupJYHlULqNoUhD+RAYAKnO88uGd5IiN2C8 AbWd6UYv2/QBcvYnTrNj0EntVJBv2ogP/YjnFWiux/X8QeVU8kNRPjsjnqoTrY63buaepI5VQyV9x oFxN+mGOMYHQ9cbDlDcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1paHoR-00AlZa-4k; Thu, 09 Mar 2023 15:04:13 +0000 Received: from mail-he1eur04on0604.outbound.protection.outlook.com ([2a01:111:f400:fe0d::604] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1paHe4-00AhRB-Mt for linux-arm-kernel@lists.infradead.org; Thu, 09 Mar 2023 14:53:30 +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=cPm9V/BgkIcnlBOldXtYcxFlXb656/rgWGVkGjd32E4=; b=sAuhz8Z6Xfvn8CysdeLN44Uf9CncDzk9Aw7NXjSOZha3M4HkQvlCxErV1OH45kkXtZuSUpSl4VzEXbopZEyTNyLmSnxHL1JEOF2wps2IrqBplveBujJSHWGxOcucm0/DtkDVml6/Q46+kcCewQmXgUT491ZskL1jRbqW9PzjKCQ= Received: from AM6P193CA0124.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::29) by DB9PR08MB7472.eurprd08.prod.outlook.com (2603:10a6:10:36c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Thu, 9 Mar 2023 14:53:24 +0000 Received: from VI1EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:85:cafe::bb) by AM6P193CA0124.outlook.office365.com (2603:10a6:209:85::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19 via Frontend Transport; Thu, 9 Mar 2023 14:53:24 +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 VI1EUR03FT023.mail.protection.outlook.com (100.127.144.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19 via Frontend Transport; Thu, 9 Mar 2023 14:53:24 +0000 Received: ("Tessian outbound fcd8b5fba459:v135"); Thu, 09 Mar 2023 14:53:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4a722604b74b6ab4 X-CR-MTA-TID: 64aa7808 Received: from dbe0ca4c516d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B1BFD5E9-57DA-43D0-A17A-87CE85D76939.1; Thu, 09 Mar 2023 14:53:15 +0000 Received: from EUR02-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id dbe0ca4c516d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 09 Mar 2023 14:53:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gYeyiA5BvfrFy/mslFjPLlPK6wToF2zHwh0ynqbii+hFWziowOSEFT/HGz8L54Bu6p3G+PA4kv8YfyUIPksiWlKro394WT8/vP4DV72BZIMDZ8iox6TE6VWgrbeIqQLlAiXU4gZeg0dbP94nvfZckUr8petygNFgvMfeklI8WRbDPA2MSpWUWOBiM3GcIMz73eq6j0Bp4rxyh+XeMf3NYbFPrIs5mXbx5r3UGPSBmAEQdoQANBhPfqgOg6ddK7AvfdFSemRB8v1eM2jLdnNp0gtmmsMhcI62yZjb/QJm/N876sXyVQH5eqiNtG7XNTued953pbSwhqYyxzmAX8T9Mg== 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=cPm9V/BgkIcnlBOldXtYcxFlXb656/rgWGVkGjd32E4=; b=TcCebVuKhc0sXUeB3uQs9qsUSuSWx0CQiu4HhnOGnQTwXIJWQy/ax+8EB5NpL35/sB6rR/YbPoe4vOYukYzezms0wDExYxfTXkp4FMqggqgcRoM1l6U+Naom+sMmwNKJgegKVTJhqCaseGYuabmPSD6E4Mwf21ni2EEa4P2x2iuw/fEusR6+/lQZZQQJTp+CHQDmonnmqsKiAtDwwikarQAT+BU8RD51GyOhK+DzX/wuiiw5EqgBcSQIlHIqJIPzdDIa7eYhc9JEQoetG6kG9EiHRZGy1wTWaD+bjTjUg4t3Xu1JpVM2gxjRECQ6KyqOacNL0/CpNHoLwll8AnWLiw== 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=cPm9V/BgkIcnlBOldXtYcxFlXb656/rgWGVkGjd32E4=; b=sAuhz8Z6Xfvn8CysdeLN44Uf9CncDzk9Aw7NXjSOZha3M4HkQvlCxErV1OH45kkXtZuSUpSl4VzEXbopZEyTNyLmSnxHL1JEOF2wps2IrqBplveBujJSHWGxOcucm0/DtkDVml6/Q46+kcCewQmXgUT491ZskL1jRbqW9PzjKCQ= Received: from FR3P281CA0113.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::12) by GV1PR08MB10369.eurprd08.prod.outlook.com (2603:10a6:150:a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.27; Thu, 9 Mar 2023 14:53:10 +0000 Received: from VI1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:a3:cafe::31) by FR3P281CA0113.outlook.office365.com (2603:10a6:d10:a3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.18 via Frontend Transport; Thu, 9 Mar 2023 14:53:10 +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 VI1EUR03FT041.mail.protection.outlook.com (100.127.145.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.19 via Frontend Transport; Thu, 9 Mar 2023 14:53:09 +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, 9 Mar 2023 14:52:57 +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, 9 Mar 2023 14:52:57 +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, 9 Mar 2023 14:52:57 +0000 From: Joey Gouly To: CC: , , , , , , , , , , Subject: [PATCH v1 17/18] arm64: enable Permission Indirection Extension (PIE) Date: Thu, 9 Mar 2023 14:52:45 +0000 Message-ID: <20230309145246.22787-18-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230309145246.22787-1-joey.gouly@arm.com> References: <20230309145246.22787-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: VI1EUR03FT041:EE_|GV1PR08MB10369:EE_|VI1EUR03FT023:EE_|DB9PR08MB7472:EE_ X-MS-Office365-Filtering-Correlation-Id: e170b2b3-9b3e-4d4f-12a1-08db20ae0873 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: xnk4EN1FTYMSPcroqu0Vb122DkwK/OhLouvz7ribULVzwehjw8sPHluFxCz0UAQWRV/vERQPcb43tqKUXlu75U3AXw4k5tNBRGAeyPAYlJ/XiOwfQsz3Q+HvggK8PRK3idciKm5cupfmzzODLSiA3U8CcPt7kmTqzQXjIQi1Xg7TXrzCdmu9HLc71wvSXXDyDS4y5mE0i2Lg1bEXBRDO/LV7PdWVfZf2J99h97ocAU8WDWVcTCqDS7WOR/i3b4/dh6QykSBOROIXwtNEzW97dE/S162zV7d9noSgcbZJkusdh3y7ESEAxl4IbudgmsRq8skEDr5Mc6mMvpqljwAdVbLWVfyxmtYiwVoMcfF8JZNf4kE7NpiKUbHMSlBGo5KihG9y3Ks9GLB5aRGanUNyBZOjy4Ge0sKhxmrWGaFahWB3Pq7BovWfWmRzZuC+8ObiMaK9GgvulvfYH30tVNP9t4/RUeOO4a0W3ePwTuUKLSd72u4tInbxTdsOjwendmGKkWuwHLEg/tH+OBCUsAOgcHT3SCsmxRw41tZnYW4ZTE31XGZMu/OJj1CJKp3uN+9jqLDfB8YK2IiRMtrY+Z7rkpyFMIjR3arMBgg3hSRxw1fhyTHK+Hm8cOY3FwqPTA77fWHNXVTRecxk2IFs2OsKBb6ygnzv1B0+1pkNXVP2znVwEu2UfmYq8SGzTHF+v0kcJa/JBe3x0oLhYvCj9Vdwjg== 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:(13230025)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199018)(46966006)(36840700001)(186003)(2906002)(44832011)(6666004)(356005)(41300700001)(4326008)(36860700001)(70206006)(8676002)(6916009)(5660300002)(70586007)(8936002)(4744005)(2616005)(81166007)(426003)(47076005)(1076003)(82740400003)(478600001)(7696005)(26005)(36756003)(86362001)(54906003)(40480700001)(82310400005)(316002)(336012)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB10369 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3f0899e1-f83a-482c-12e1-08db20ae000d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4CiIvigZkfxn1UMjRc9KzeIWW+yUFDzGwTYMOVOF2xyphx1I52UFIvhUXJaFq8sbQ7ytyIIM/iNgxJKojkmSHVX2OYGFzm5kvMhqxMwThrdbR/0d2LNbKDwlDDQJXXSXl2wg92OBSyh5srfkpgVFjVDnmbh1u7nkwuOh4Yzt12vxD2VqdbOV57a8cXSMBDJJnzyfEV4W9zEZUnT95GmPHDv0D0n+uENay5R5eK+r7ZLQWqT1OMZkyGTuw+JYUzwYot/4hzwonyvppo55dyrMQIPAC01Gpcrgm0TLqOBTrWe8q5MKhtBm5vyG5ArbtxkBwyJFxcOzla63Rn9lE3NIYQ/3sVyYoHTVm678E8BXpy+ByzBFTVdWz6BFTbFK3RIL46AGA8DTqbHu09v50E7doYz8QIDrRmUNy6xP9el02kW4aWxcTQfNYpnzrFV2DURZiRiAVMQr8g+bA9ueLtnfmEANxHaIy550eGK9DFs0E3sSBA8tAaC98J2+YCOGBYVwzbeTsSJMHAu0EZsln+t7NVNHeePl/0bjNPHQWo9Y4wyR0y49160a4XbQZASsyelfYEYsQnAv89IJPniSQW3BVTxRic2+nt2LsHOrL7tTPYEG+uRDbeyR3d8PJZqIlWYSQ6Od0val4H/pfRgp7uaj0M/KdQafL1M7jsPTL1219tskaNOPa7RkXQzLtC9V13zCWPlJu0n+Whqri8GR07J3Cw== 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:(13230025)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(4744005)(44832011)(5660300002)(8936002)(2906002)(41300700001)(6666004)(70206006)(8676002)(4326008)(6916009)(70586007)(316002)(54906003)(40460700003)(107886003)(478600001)(7696005)(1076003)(47076005)(426003)(82310400005)(81166007)(40480700001)(86362001)(186003)(336012)(26005)(2616005)(36756003)(82740400003)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2023 14:53:24.0277 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e170b2b3-9b3e-4d4f-12a1-08db20ae0873 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: VI1EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7472 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230309_065328_792135_23D1F258 X-CRM114-Status: UNSURE ( 8.36 ) X-CRM114-Notice: Please train this message. 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 Now that the necessary changes have been made, set the Permission Indirection registers and enable the Permission Indirection Extension. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas --- arch/arm64/mm/proc.S | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 644e8daa25df..5734f077dd46 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -454,6 +454,21 @@ SYM_FUNC_START(__cpu_setup) #endif /* CONFIG_ARM64_HW_AFDBM */ msr mair_el1, mair msr tcr_el1, tcr + + mrs_s x1, SYS_ID_AA64MMFR3_EL1 + ubfx x1, x1, #ID_AA64MMFR3_EL1_S1PIE_SHIFT, #4 + cbz x1, .Lskip_indirection + + mov_q x0, PIE_E0 + msr REG_PIRE0_EL1, x0 + mov_q x0, PIE_E1 + msr REG_PIR_EL1, x0 + + mov x0, TCR2_ELx_PIE + msr REG_TCR2_EL1, x0 + +.Lskip_indirection: + /* * Prepare SCTLR */