mremap move ZERO_PAGE fix
PATCH 1/1 mremap move ZERO_PAGE fix
Fix nasty little bug we've missed in Nick's mremap move ZERO_PAGE patch. The "pte" at that point may be a swap entry or a pte_file entry: we must check pte_present before perhaps corrupting such an entry.
Patch below against 2.6.14-rc2-mm1, but the same bug is in 2.6.14-rc2's mm/mremap.c, and more dangerous there since it's affecting all arches:
I think the safest course is to send Nick's patch and Yoichi's build fix and this fix (build tested) on to Linus - so only MIPS can be affected.
include/asm-generic/pgtable.h +2 -1
@@ -164,7 +164,8 @@ static inline void ptep_set_wrprotect(st#define move_pte (pte, prot, old_addr, new_addr) \ ({ \ pte_t newpte = (pte); \ - if (pfn_valid(pte_pfn(pte)) && pte_page(pte) == ZERO_PAGE(old_addr)) \ + if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ + pte_page(pte) == ZERO_PAGE(old_addr)) \ newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ newpte; \ })
Quoted 9 lines · Hugh Dickins
Fix nasty little bug we've missed in Nick's mremap move
ZERO_PAGEpatch. The "pte" at that point may be a swap entry or apte_fileentry: we must checkpte_presentbefore perhaps corrupting such an entry.Patch below against 2.6.14-rc2-mm1, but the same bug is in 2.6.14-rc2's
mm/mremap.c, and more dangerous there since it's affecting all arches:
I think the safest course is to send Nick's patch and Yoichi's build fix and this fix (build tested) on to Linus - so only MIPS can be affected.
Thanks Hugh. I agree with your proposed merge plan.
Signature · 3 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com