* [PATCH] arm64: enable PTE type bit in the mask for pte_modify
@ 2015-02-24 23:40 Feng Kan
2015-02-25 16:43 ` Catalin Marinas
0 siblings, 1 reply; 2+ messages in thread
From: Feng Kan @ 2015-02-24 23:40 UTC (permalink / raw)
To: linux-arm-kernel
Caught during Trinity testing. The pte_modify does not allow
modification for PTE type bit. This cause the test to hang
the system. It is found that the PTE can't transit from an
inaccessible page (b00) to a valid page (b11) because the mask
does not allow it. This happens when a big block of mmaped
memory is set the PROT_NONE, then the a small piece is broken
off and set to PROT_WRITE | PROT_READ cause a huge page split.
Signed-off-by: Feng Kan <fkan@apm.com>
---
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 a26a574..8255b52 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -462,7 +462,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long addr)
static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
{
const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY |
- PTE_PROT_NONE | PTE_VALID | PTE_WRITE;
+ PTE_PROT_NONE | PTE_WRITE | PTE_TYPE_MASK;
pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
return pte;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH] arm64: enable PTE type bit in the mask for pte_modify
2015-02-24 23:40 [PATCH] arm64: enable PTE type bit in the mask for pte_modify Feng Kan
@ 2015-02-25 16:43 ` Catalin Marinas
0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2015-02-25 16:43 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 24, 2015 at 03:40:21PM -0800, Feng Kan wrote:
> Caught during Trinity testing. The pte_modify does not allow
> modification for PTE type bit. This cause the test to hang
> the system. It is found that the PTE can't transit from an
> inaccessible page (b00) to a valid page (b11) because the mask
> does not allow it. This happens when a big block of mmaped
> memory is set the PROT_NONE, then the a small piece is broken
> off and set to PROT_WRITE | PROT_READ cause a huge page split.
>
> Signed-off-by: Feng Kan <fkan@apm.com>
It looks fine to me. Thanks.
I wonder whether mprotect() to change between PROT_NONE and an
accessible protection ever worked (I thought we tested this).
--
Catalin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-25 16:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 23:40 [PATCH] arm64: enable PTE type bit in the mask for pte_modify Feng Kan
2015-02-25 16:43 ` Catalin Marinas
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).