We do not want take POE into account when clearing the MTE tags.

Signed-off-by: Joey Gouly <joey.go...@arm.com>
Cc: Catalin Marinas <catalin.mari...@arm.com>
Cc: Will Deacon <w...@kernel.org>
Reviewed-by: Catalin Marinas <catalin.mari...@arm.com>
Reviewed-by: Anshuman Khandual <anshuman.khand...@arm.com>
---
 arch/arm64/include/asm/pgtable.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git arch/arm64/include/asm/pgtable.h arch/arm64/include/asm/pgtable.h
index 1d0f18d30e1e..61a674942a6b 100644
--- arch/arm64/include/asm/pgtable.h
+++ arch/arm64/include/asm/pgtable.h
@@ -156,8 +156,10 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
  * not set) must return false. PROT_NONE mappings do not have the
  * PTE_VALID bit set.
  */
-#define pte_access_permitted(pte, write) \
+#define pte_access_permitted_no_overlay(pte, write) \
        (((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) && 
(!(write) || pte_write(pte)))
+#define pte_access_permitted(pte, write) \
+       pte_access_permitted_no_overlay(pte, write)
 #define pmd_access_permitted(pmd, write) \
        (pte_access_permitted(pmd_pte(pmd), (write)))
 #define pud_access_permitted(pud, write) \
@@ -373,10 +375,11 @@ static inline void __sync_cache_and_tags(pte_t pte, 
unsigned int nr_pages)
        /*
         * If the PTE would provide user space access to the tags associated
         * with it then ensure that the MTE tags are synchronised.  Although
-        * pte_access_permitted() returns false for exec only mappings, they
-        * don't expose tags (instruction fetches don't check tags).
+        * pte_access_permitted_no_overlay() returns false for exec only
+        * mappings, they don't expose tags (instruction fetches don't check
+        * tags).
         */
-       if (system_supports_mte() && pte_access_permitted(pte, false) &&
+       if (system_supports_mte() && pte_access_permitted_no_overlay(pte, 
false) &&
            !pte_special(pte) && pte_tagged(pte))
                mte_sync_tags(pte, nr_pages);
 }
-- 
2.25.1


Reply via email to