arm64: pgtable: Clear the GP bit for non-executable kernel pages
Will Deacon
maintainerPATCH 1/1 arm64: pgtable: Clear the GP bit for non-executable kernel pages
Commit cca98e9f8b5e ("mm: enforce that vmap can't map pages executable") introduced 'pgprot_nx(prot)' for arm64 but colliding silently with the BTI support during the merge window, which endeavours to clear the GP bit for non-executable kernel mappings in set_memory_nx().
For consistency between the two APIs, clear the GP bit in pgprot_nx().
--- arch/arm64/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h +1 -1
@@ -416,7 +416,7 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd) __pgprot((pgprot_val(prot) & ~(mask)) | (bits))#define pgprot_nx (prot) \ - __pgprot_modify(prot, 0, PTE_PXN) + __pgprot_modify(prot, PTE_MAYBE_GP, PTE_PXN)/* * Mark the prot value as uncacheable and unbufferable.
Signature · 7 lines
2.27.0.290.gba653c62da-goog _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 4 lines · Will Deacon
Commit
cca98e9f8b5e("mm: enforce that vmap can't map pages executable") introduced 'pgprot_nx(prot)' for arm64 but colliding silently with the BTI support during the merge window, which endeavours to clear the GP bit for non-executable kernel mappings inset_memory_nx().
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 19 lines · Will Deacon
Commit
cca98e9f8b5e("mm: enforce that vmap can't map pages executable") introduced 'pgprot_nx(prot)' for arm64 but colliding silently with the BTI support during the merge window, which endeavours to clear the GP bit for non-executable kernel mappings inset_memory_nx().For consistency between the two APIs, clear the GP bit in
pgprot_nx().Cc Mark Rutland <[email protected]>Cc Mark Brown <[email protected]>Signed-off-by Will Deacon <[email protected]>--- arch/arm64/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/include/asm/pgtable.h +0
-0
arch/arm64/include/asm/pgtable.h static inline pmd_t pmd_mkdevmap(pmd_t pmd) · line 419
Quoted 5 lines
arch/arm64/include/asm/pgtable.h +1
-1@@ -416,7 +416,7 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd) __pgprot((pgprot_val(prot) & ~(mask)) | (bits))#define pgprot_nx (prot) \ - __pgprot_modify(prot, 0, PTE_PXN) + __pgprot_modify(prot, PTE_MAYBE_GP, PTE_PXN)
Since this is just used to clear the bit, we could use PTE_GP directly and allow the compiler to constant fold this.
Either way:
Mark.
Quoted 6 lines
arch/arm64/include/asm/pgtable.h +0
-0/* * Mark the prot value as uncacheable and unbufferable. Signature · 1 line
2.27.0.290.gba653c62da-goog
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel