From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4A41C3DA49 for ; Tue, 16 Jul 2024 13:46:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 694296B009C; Tue, 16 Jul 2024 09:46:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 61D016B009F; Tue, 16 Jul 2024 09:46:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BD6D6B00A2; Tue, 16 Jul 2024 09:46:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2A4516B009C for ; Tue, 16 Jul 2024 09:46:36 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id CA592A0613 for ; Tue, 16 Jul 2024 13:46:35 +0000 (UTC) X-FDA: 82345740750.06.4FA6797 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id BE87440015 for ; Tue, 16 Jul 2024 13:46:33 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721137562; a=rsa-sha256; cv=none; b=YZN1EibuUxt4L0Beg3+FiWAVMQKnx1YWsLQ22fzOBFyLtyySvtwRmnfAKrLhne+PsYMN48 FU1563ZXJ4glPT9ISUcPPdPOlV82G2GdMGgNcqUqkaABcKFXsHozaFgdKJj738WsyFibVk TxfMmOSAvLs1+jhKvpOoem43U4Ry1I4= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721137562; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W9MeOIFMBIqKcYm4k1SiaIfF27ODMhRhQ39Dx8OyS4U=; b=Lw4PbFHsoBrcQ4Hp27K8WKkmNn9RuoYs+T/pJQmJNPEcpn8zToyQbIQXP+E6RQfiCKjHJQ o+KHTZzHq+0bP/lhZR2aBqcxAQlGkQRY7LMCNB6iGNy04z2dDv3swA80+Mirvdv3fzxJRo Fn5LP0eYajv3J4jWf6b9T6e0phipems= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E6E4D1063; Tue, 16 Jul 2024 06:46:57 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1EB003F762; Tue, 16 Jul 2024 06:46:28 -0700 (PDT) Date: Tue, 16 Jul 2024 14:46:23 +0100 From: Joey Gouly To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v4 20/29] arm64: enable POE and PIE to coexist Message-ID: <20240716134623.GA1570990@e124191.cambridge.arm.com> References: <20240503130147.1154804-1-joey.gouly@arm.com> <20240503130147.1154804-21-joey.gouly@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: BE87440015 X-Stat-Signature: bpm7r76mzpxikpzd3gb1jn9mp1uy8x6s X-Rspam-User: X-HE-Tag: 1721137593-882774 X-HE-Meta: U2FsdGVkX18eAN+YOqN++bq3VhybNqS0B7royyifXLld3Rx21EBdFzEBnOvuPZQDBri7LbnBMOOsg7LCnhYmINnbgAv85XzjlLioeluaHcjpyyQjDdvxrjvtbswNIOkmKfr/p7hjDaOPwWEFfAP9GHqFAQBp43OflbB5DUW51xdPHfOFZ+X4SFDtuXn65VwGyMEh5M6WEXeVe2XZ7jB1mE1jx7ZyDMzdXFKBX4my7rFqcDUcfNcosHdgDc35TMV4NvDhEYFnReqTzQWmV2XpilcarBh4npN08NSeFIPn+dK2WPQeAPdfMfLCUT6r8iz8KkpQAaO8N2Dv1U1I3mXjXrjzvQOdmUaDkXWMr9VEi8wGtoQt0KU7fv4jDM3dpI39OHyaAtXcA5F0WAK74QffR9KN3oax+H9pkeBaE7J9T8qKyUUMpIumt6DTlSyXCg1UWYI/w8jvdpbymJBobcY/gZDzy4w0Az+2ekxppZ7uvVl4deH3Wn/SHIMREUeNNtb2QTjeZuzG/iWPRCy1EG8Cys6WWC08Xl8CTDZtwHNolWtEzYCp05mF+jz4JYoElPCGpITabMTXYwe2S06e7oCYeuRTJGwHhobAkYqTTTlBmokTVd8B0xDWBuK/uDbkzb9xzpyhWW5u/ewPgjGyOiWLtFQR920X9Mt/PCkZl6f5hGxSDjMnM0EIhDRmXHqawd3iwEb7HCDd+WNe/mbFv86QXhjP79nmEEkmtsGij49+xp3cTe/7LZJp5wihsUwBY6fDwJHk2Oc+TBK7nvFg/WJOr6jWlwIg23rFluyyWHKZBUjdcWCfidd62wOdRGQNAI5YvTT5veRnbLcQWWG9PukJgw39he4kADTlZigyNoT4zpimnwavGd9mM8xTdOKsEbtr+N3Tb4gqpbJEODuzwAG6q3aCx7ZOPiMKg74McCEZXW9e82DFLazm/9dhHgSqfrBsFV4YWpehhLchWINbGn/ EA+Fh7u7 lo5Iaqtj+WGajilZonIJjmGW+5pq1G/w8+Fd7ObB6ZeolwMF8X6BPtU/IULlDvwm9zyTqmWzel4GNy8+KIdFW+OB9Z3F9FXxI30rii3VK1lusd/b7zvT8NoAXmgfuwQj6xPdGvBzOYExhhq3/lRIgTJfPB8pjFBc8XP2aRGKFEcBBc2PClsqVLFCfCKtQ6fZCS1qO7B1h6N9sKV6zjzvQgD/uv3WWxZvz9nuEfqylczJKXRhvE9yggz4Ft1bww8lQhDZPHngwS9T+VWU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Jul 16, 2024 at 04:11:54PM +0530, Anshuman Khandual wrote: > > > On 5/3/24 18:31, Joey Gouly wrote: > > Set the EL0/userspace indirection encodings to be the overlay enabled > > variants of the permissions. > > Could you please explain the rationale for this ? Should POE variants for > pte permissions be used (when available) instead of permission indirection > ones. POE and PIE can be enabled independently. When PIE is disabled, the POE is applied on top of the permissions described in the PTE. If PIE is enabled, then POE is applied on top of the indirect permissions. However, the indirect permissions have the ability to control whether POE actually applies or not. So this change makes POE apply if PIE is enabled or not. For example: Encoding of POE_EL0 0001 Read, Overlay applied ... 1000 Read, Overlay not applied. I will add something to the commit message. > > > > > Signed-off-by: Joey Gouly > > Cc: Catalin Marinas > > Cc: Will Deacon > > --- > > arch/arm64/include/asm/pgtable-prot.h | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h > > index dd9ee67d1d87..4f9f85437d3d 100644 > > --- a/arch/arm64/include/asm/pgtable-prot.h > > +++ b/arch/arm64/include/asm/pgtable-prot.h > > @@ -147,10 +147,10 @@ static inline bool __pure lpa2_is_enabled(void) > > > > #define PIE_E0 ( \ > > PIRx_ELx_PERM(pte_pi_index(_PAGE_EXECONLY), PIE_X_O) | \ > > - PIRx_ELx_PERM(pte_pi_index(_PAGE_READONLY_EXEC), PIE_RX) | \ > > - PIRx_ELx_PERM(pte_pi_index(_PAGE_SHARED_EXEC), PIE_RWX) | \ > > - PIRx_ELx_PERM(pte_pi_index(_PAGE_READONLY), PIE_R) | \ > > - PIRx_ELx_PERM(pte_pi_index(_PAGE_SHARED), PIE_RW)) > > + PIRx_ELx_PERM(pte_pi_index(_PAGE_READONLY_EXEC), PIE_RX_O) | \ > > + PIRx_ELx_PERM(pte_pi_index(_PAGE_SHARED_EXEC), PIE_RWX_O) | \ > > + PIRx_ELx_PERM(pte_pi_index(_PAGE_READONLY), PIE_R_O) | \ > > + PIRx_ELx_PERM(pte_pi_index(_PAGE_SHARED), PIE_RW_O)) > > > > #define PIE_E1 ( \ > > PIRx_ELx_PERM(pte_pi_index(_PAGE_EXECONLY), PIE_NONE_O) | \ >