Skip to content

Commit fc2d9cd

Browse files
jgoulywilldeacon
authored andcommitted
arm64: add pte_access_permitted_no_overlay()
We do not want take POE into account when clearing the MTE tags. Signed-off-by: Joey Gouly <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 7f0ab60 commit fc2d9cd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
156156
* not set) must return false. PROT_NONE mappings do not have the
157157
* PTE_VALID bit set.
158158
*/
159-
#define pte_access_permitted(pte, write) \
159+
#define pte_access_permitted_no_overlay(pte, write) \
160160
(((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) && (!(write) || pte_write(pte)))
161+
#define pte_access_permitted(pte, write) \
162+
pte_access_permitted_no_overlay(pte, write)
161163
#define pmd_access_permitted(pmd, write) \
162164
(pte_access_permitted(pmd_pte(pmd), (write)))
163165
#define pud_access_permitted(pud, write) \
@@ -373,10 +375,11 @@ static inline void __sync_cache_and_tags(pte_t pte, unsigned int nr_pages)
373375
/*
374376
* If the PTE would provide user space access to the tags associated
375377
* with it then ensure that the MTE tags are synchronised. Although
376-
* pte_access_permitted() returns false for exec only mappings, they
377-
* don't expose tags (instruction fetches don't check tags).
378+
* pte_access_permitted_no_overlay() returns false for exec only
379+
* mappings, they don't expose tags (instruction fetches don't check
380+
* tags).
378381
*/
379-
if (system_supports_mte() && pte_access_permitted(pte, false) &&
382+
if (system_supports_mte() && pte_access_permitted_no_overlay(pte, false) &&
380383
!pte_special(pte) && pte_tagged(pte))
381384
mte_sync_tags(pte, nr_pages);
382385
}

0 commit comments

Comments
 (0)