From: kfraser@localhost.localdomain Date: Mon, 13 Nov 2006 13:37:54 +0000 (+0000) Subject: [LINUX] Fix clear_fixmap(). X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15551^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8f3784dc2b4aee97736a38c504d89da16e1db41f;p=xen.git [LINUX] Fix clear_fixmap(). On i386-PAE, clear_fixmap() results in ill use of set_pte(). In all contexts, p2m translations shouldn't occur here. Note that this is not really an issue on native linux, as there is (a) no pfn-to-mfn translation and (b) __set_fixmap() takes an unsigned long physical address rather than a paddr_t, which makes it so that bits 32 and up of the physical address are always zero, permitting either order store when clearing the entry. Signed-off-by: Jan Beulich --- diff --git a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c index d843538917..0ff01f52f8 100644 --- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c +++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c @@ -102,8 +102,11 @@ static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) return; } pte = pte_offset_kernel(pmd, vaddr); - /* stored as-is, to permit clearing entries */ - set_pte(pte, pfn_pte(pfn, flags)); + if (pgprot_val(flags)) + /* stored as-is, to permit clearing entries */ + set_pte(pte, pfn_pte(pfn, flags)); + else + pte_clear(&init_mm, vaddr, pte); /* * It's enough to flush this one mapping. @@ -140,8 +143,11 @@ static void set_pte_pfn_ma(unsigned long vaddr, unsigned long pfn, return; } pte = pte_offset_kernel(pmd, vaddr); - /* stored as-is, to permit clearing entries */ - set_pte(pte, pfn_pte_ma(pfn, flags)); + if (pgprot_val(flags)) + /* stored as-is, to permit clearing entries */ + set_pte(pte, pfn_pte_ma(pfn, flags)); + else + pte_clear(&init_mm, vaddr, pte); /* * It's enough to flush this one mapping. diff --git a/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c index 61c75c08a6..455b20b47e 100644 --- a/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c +++ b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c @@ -260,7 +260,10 @@ static void set_pte_phys(unsigned long vaddr, return; } } - new_pte = pfn_pte(phys >> PAGE_SHIFT, prot); + if (pgprot_val(prot)) + new_pte = pfn_pte(phys >> PAGE_SHIFT, prot); + else + new_pte = __pte(0); pte = pte_offset_kernel(pmd, vaddr); if (!pte_none(*pte) &&