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 <joey.gouly@xxxxxxx> > > Cc: Catalin Marinas <catalin.marinas@xxxxxxx> > > Cc: Will Deacon <will@xxxxxxxxxx> > > --- > > 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) | \ >