[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Zero out newly allocated xenheap pages for page tables,



ChangeSet 1.1668.1.7, 2005/06/09 14:21:50-06:00, djm@xxxxxxxxxxxxxxx

        Zero out newly allocated xenheap pages for page tables,
        also newly allocated domheap pages.
        Signed-off by: Dan Magenheimer <dan.magenheimer@xxxxxx>



 domain.c                     |    5 ++++-
 patch/linux-2.6.11/pgalloc.h |   11 +++++------
 process.c                    |    4 ----
 3 files changed, 9 insertions(+), 11 deletions(-)


diff -Nru a/xen/arch/ia64/domain.c b/xen/arch/ia64/domain.c
--- a/xen/arch/ia64/domain.c    2005-06-10 14:04:21 -04:00
+++ b/xen/arch/ia64/domain.c    2005-06-10 14:04:21 -04:00
@@ -453,7 +453,11 @@
                if (d == dom0) p = map_new_domain0_page(mpaddr);
                else
 #endif
+               {
                        p = alloc_domheap_page(d);
+                       // zero out pages for security reasons
+                       memset(__va(page_to_phys(p)),0,PAGE_SIZE);
+               }
                if (unlikely(!p)) {
 printf("map_new_domain_page: Can't alloc!!!! Aaaargh!\n");
                        return(p);
@@ -512,7 +516,6 @@
        }
        /* if lookup fails and mpaddr is "legal", "create" the page */
        if ((mpaddr >> PAGE_SHIFT) < d->max_pages) {
-               // FIXME: should zero out pages for security reasons
                if (map_new_domain_page(d,mpaddr)) goto tryagain;
        }
        printk("lookup_domain_mpa: bad mpa %p (> %p\n",
diff -Nru a/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h 
b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h
--- a/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h        2005-06-10 14:04:21 
-04:00
+++ b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h        2005-06-10 14:04:21 
-04:00
@@ -1,54 +1,58 @@
 --- ../../linux-2.6.11/include/asm-ia64/pgalloc.h      2005-03-02 
00:37:31.000000000 -0700
-+++ include/asm-ia64/pgalloc.h 2005-04-29 17:09:20.000000000 -0600
-@@ -61,7 +61,11 @@
++++ include/asm-ia64/pgalloc.h 2005-06-09 13:40:48.000000000 -0600
+@@ -61,7 +61,12 @@
        pgd_t *pgd = pgd_alloc_one_fast(mm);
  
        if (unlikely(pgd == NULL)) {
 +#ifdef XEN
 +              pgd = (pgd_t *)alloc_xenheap_page();
++              memset(pgd,0,PAGE_SIZE);
 +#else
                pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
 +#endif
        }
        return pgd;
  }
-@@ -104,7 +108,11 @@
+@@ -104,7 +109,12 @@
  static inline pmd_t*
  pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
  {
 +#ifdef XEN
 +      pmd_t *pmd = (pmd_t *)alloc_xenheap_page();
++      memset(pmd,0,PAGE_SIZE);
 +#else
        pmd_t *pmd = (pmd_t 
*)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
 +#endif
  
        return pmd;
  }
-@@ -136,7 +144,11 @@
+@@ -136,7 +146,12 @@
  static inline struct page *
  pte_alloc_one (struct mm_struct *mm, unsigned long addr)
  {
 +#ifdef XEN
 +      struct page *pte = alloc_xenheap_page();
++      memset(pte,0,PAGE_SIZE);
 +#else
        struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
 +#endif
  
        return pte;
  }
-@@ -144,7 +156,11 @@
+@@ -144,7 +159,12 @@
  static inline pte_t *
  pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr)
  {
 +#ifdef XEN
 +      pte_t *pte = (pte_t *)alloc_xenheap_page();
++      memset(pte,0,PAGE_SIZE);
 +#else
        pte_t *pte = (pte_t 
*)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
 +#endif
  
        return pte;
  }
-@@ -152,13 +168,21 @@
+@@ -152,13 +172,21 @@
  static inline void
  pte_free (struct page *pte)
  {
diff -Nru a/xen/arch/ia64/process.c b/xen/arch/ia64/process.c
--- a/xen/arch/ia64/process.c   2005-06-10 14:04:21 -04:00
+++ b/xen/arch/ia64/process.c   2005-06-10 14:04:21 -04:00
@@ -822,8 +822,6 @@
 #define INTR_TYPE_MAX  10
 UINT64 int_counts[INTR_TYPE_MAX];
 
-void dis_foo(void) { }
-
 void
 ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long 
isr, unsigned long iim, unsigned long vector)
 {
@@ -858,8 +856,6 @@
                vector = IA64_DATA_ACCESS_RIGHTS_VECTOR; break;
            case 25:
                vector = IA64_DISABLED_FPREG_VECTOR;
-//printf("*** Attempting to handle disabled_fpreg\n");
-               dis_foo();
                break;
            case 26:
 printf("*** NaT fault... attempting to handle as privop\n");

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.