Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: enable PTE type bit in the mask for pte_modify

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>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Feng Kan and committed by
Catalin Marinas
6910fa16 06ff87ba

+1 -1
+1 -1
arch/arm64/include/asm/pgtable.h
··· 460 460 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 461 461 { 462 462 const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY | 463 - PTE_PROT_NONE | PTE_VALID | PTE_WRITE; 463 + PTE_PROT_NONE | PTE_WRITE | PTE_TYPE_MASK; 464 464 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); 465 465 return pte; 466 466 }