* [PATCH] arm64: pgtable: Clear the GP bit for non-executable kernel pages
@ 2020-06-15 15:46 Will Deacon
2020-06-15 16:19 ` Mark Brown
2020-06-16 8:45 ` Mark Rutland
0 siblings, 2 replies; 3+ messages in thread
From: Will Deacon @ 2020-06-15 15:46 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Mark Rutland, Will Deacon, Mark Brown, kernel-team
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().
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
---
arch/arm64/include/asm/pgtable.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 6dbd267ab931..758e2d1577d0 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -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.
--
2.27.0.290.gba653c62da-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64: pgtable: Clear the GP bit for non-executable kernel pages
2020-06-15 15:46 [PATCH] arm64: pgtable: Clear the GP bit for non-executable kernel pages Will Deacon
@ 2020-06-15 16:19 ` Mark Brown
2020-06-16 8:45 ` Mark Rutland
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-06-15 16:19 UTC (permalink / raw)
To: Will Deacon; +Cc: Mark Rutland, kernel-team, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 388 bytes --]
On Mon, Jun 15, 2020 at 04:46:42PM +0100, Will Deacon wrote:
> 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().
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64: pgtable: Clear the GP bit for non-executable kernel pages
2020-06-15 15:46 [PATCH] arm64: pgtable: Clear the GP bit for non-executable kernel pages Will Deacon
2020-06-15 16:19 ` Mark Brown
@ 2020-06-16 8:45 ` Mark Rutland
1 sibling, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2020-06-16 8:45 UTC (permalink / raw)
To: Will Deacon; +Cc: Mark Brown, kernel-team, linux-arm-kernel
On Mon, Jun 15, 2020 at 04:46:42PM +0100, Will Deacon wrote:
> 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().
>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Mark Brown <broonie@kernel.org>
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
> arch/arm64/include/asm/pgtable.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 6dbd267ab931..758e2d1577d0 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -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:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
>
> /*
> * Mark the prot value as uncacheable and unbufferable.
> --
> 2.27.0.290.gba653c62da-goog
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-16 8:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-15 15:46 [PATCH] arm64: pgtable: Clear the GP bit for non-executable kernel pages Will Deacon
2020-06-15 16:19 ` Mark Brown
2020-06-16 8:45 ` Mark Rutland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).