WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] linux/x86: fix clear_fixmap()

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux/x86: fix clear_fixmap()
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 08 Nov 2006 10:44:49 +0100
Delivery-date: Wed, 08 Nov 2006 01:44:04 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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 <jbeulich@xxxxxxxxxx>

Index: head-2006-11-06/arch/i386/mm/pgtable-xen.c
===================================================================
--- head-2006-11-06.orig/arch/i386/mm/pgtable-xen.c     2006-11-06 
09:07:40.000000000 +0100
+++ head-2006-11-06/arch/i386/mm/pgtable-xen.c  2006-11-06 12:22:54.000000000 
+0100
@@ -102,8 +102,11 @@ static void set_pte_pfn(unsigned long va
                return;
        }
        pte = pte_offset_kernel(pmd, vaddr);
-       /* <pfn,flags> stored as-is, to permit clearing entries */
-       set_pte(pte, pfn_pte(pfn, flags));
+       if (pgprot_val(flags))
+               /* <pfn,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
                return;
        }
        pte = pte_offset_kernel(pmd, vaddr);
-       /* <pfn,flags> stored as-is, to permit clearing entries */
-       set_pte(pte, pfn_pte_ma(pfn, flags));
+       if (pgprot_val(flags))
+               /* <pfn,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.
Index: head-2006-11-06/arch/x86_64/mm/init-xen.c
===================================================================
--- head-2006-11-06.orig/arch/x86_64/mm/init-xen.c      2006-11-06 
09:10:06.000000000 +0100
+++ head-2006-11-06/arch/x86_64/mm/init-xen.c   2006-11-06 12:19:49.000000000 
+0100
@@ -260,7 +260,10 @@ static __init void set_pte_phys(unsigned
                        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) &&



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux/x86: fix clear_fixmap(), Jan Beulich <=