ia64/xen-unstable

changeset 5404:9ea1f1f71313

bitkeeper revision 1.1668.1.7 (42a8a4de9UsUPhyAknlQBRJ3xbTHtw)

Zero out newly allocated xenheap pages for page tables,
also newly allocated domheap pages.
Signed-off by: Dan Magenheimer <dan.magenheimer@hp.com>
author djm@kirby.fc.hp.com
date Thu Jun 09 20:21:50 2005 +0000 (2005-06-09)
parents f40340412b5a
children 9b7aea0fb25c
files xen/arch/ia64/domain.c xen/arch/ia64/patch/linux-2.6.11/pgalloc.h xen/arch/ia64/process.c
line diff
     1.1 --- a/xen/arch/ia64/domain.c	Thu Jun 09 14:43:55 2005 +0000
     1.2 +++ b/xen/arch/ia64/domain.c	Thu Jun 09 20:21:50 2005 +0000
     1.3 @@ -453,7 +453,11 @@ extern unsigned long vhpt_paddr, vhpt_pe
     1.4  		if (d == dom0) p = map_new_domain0_page(mpaddr);
     1.5  		else
     1.6  #endif
     1.7 +		{
     1.8  			p = alloc_domheap_page(d);
     1.9 +			// zero out pages for security reasons
    1.10 +			memset(__va(page_to_phys(p)),0,PAGE_SIZE);
    1.11 +		}
    1.12  		if (unlikely(!p)) {
    1.13  printf("map_new_domain_page: Can't alloc!!!! Aaaargh!\n");
    1.14  			return(p);
    1.15 @@ -512,7 +516,6 @@ tryagain:
    1.16  	}
    1.17  	/* if lookup fails and mpaddr is "legal", "create" the page */
    1.18  	if ((mpaddr >> PAGE_SHIFT) < d->max_pages) {
    1.19 -		// FIXME: should zero out pages for security reasons
    1.20  		if (map_new_domain_page(d,mpaddr)) goto tryagain;
    1.21  	}
    1.22  	printk("lookup_domain_mpa: bad mpa %p (> %p\n",
     2.1 --- a/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Thu Jun 09 14:43:55 2005 +0000
     2.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Thu Jun 09 20:21:50 2005 +0000
     2.3 @@ -1,54 +1,58 @@
     2.4  --- ../../linux-2.6.11/include/asm-ia64/pgalloc.h	2005-03-02 00:37:31.000000000 -0700
     2.5 -+++ include/asm-ia64/pgalloc.h	2005-04-29 17:09:20.000000000 -0600
     2.6 -@@ -61,7 +61,11 @@
     2.7 ++++ include/asm-ia64/pgalloc.h	2005-06-09 13:40:48.000000000 -0600
     2.8 +@@ -61,7 +61,12 @@
     2.9   	pgd_t *pgd = pgd_alloc_one_fast(mm);
    2.10   
    2.11   	if (unlikely(pgd == NULL)) {
    2.12  +#ifdef XEN
    2.13  +		pgd = (pgd_t *)alloc_xenheap_page();
    2.14 ++		memset(pgd,0,PAGE_SIZE);
    2.15  +#else
    2.16   		pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
    2.17  +#endif
    2.18   	}
    2.19   	return pgd;
    2.20   }
    2.21 -@@ -104,7 +108,11 @@
    2.22 +@@ -104,7 +109,12 @@
    2.23   static inline pmd_t*
    2.24   pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
    2.25   {
    2.26  +#ifdef XEN
    2.27  +	pmd_t *pmd = (pmd_t *)alloc_xenheap_page();
    2.28 ++	memset(pmd,0,PAGE_SIZE);
    2.29  +#else
    2.30   	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
    2.31  +#endif
    2.32   
    2.33   	return pmd;
    2.34   }
    2.35 -@@ -136,7 +144,11 @@
    2.36 +@@ -136,7 +146,12 @@
    2.37   static inline struct page *
    2.38   pte_alloc_one (struct mm_struct *mm, unsigned long addr)
    2.39   {
    2.40  +#ifdef XEN
    2.41  +	struct page *pte = alloc_xenheap_page();
    2.42 ++	memset(pte,0,PAGE_SIZE);
    2.43  +#else
    2.44   	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
    2.45  +#endif
    2.46   
    2.47   	return pte;
    2.48   }
    2.49 -@@ -144,7 +156,11 @@
    2.50 +@@ -144,7 +159,12 @@
    2.51   static inline pte_t *
    2.52   pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr)
    2.53   {
    2.54  +#ifdef XEN
    2.55  +	pte_t *pte = (pte_t *)alloc_xenheap_page();
    2.56 ++	memset(pte,0,PAGE_SIZE);
    2.57  +#else
    2.58   	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
    2.59  +#endif
    2.60   
    2.61   	return pte;
    2.62   }
    2.63 -@@ -152,13 +168,21 @@
    2.64 +@@ -152,13 +172,21 @@
    2.65   static inline void
    2.66   pte_free (struct page *pte)
    2.67   {
     3.1 --- a/xen/arch/ia64/process.c	Thu Jun 09 14:43:55 2005 +0000
     3.2 +++ b/xen/arch/ia64/process.c	Thu Jun 09 20:21:50 2005 +0000
     3.3 @@ -822,8 +822,6 @@ ia64_handle_privop (unsigned long ifa, s
     3.4  #define INTR_TYPE_MAX	10
     3.5  UINT64 int_counts[INTR_TYPE_MAX];
     3.6  
     3.7 -void dis_foo(void) { }
     3.8 -
     3.9  void
    3.10  ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long isr, unsigned long iim, unsigned long vector)
    3.11  {
    3.12 @@ -858,8 +856,6 @@ ia64_handle_reflection (unsigned long if
    3.13  		vector = IA64_DATA_ACCESS_RIGHTS_VECTOR; break;
    3.14  	    case 25:
    3.15  		vector = IA64_DISABLED_FPREG_VECTOR;
    3.16 -//printf("*** Attempting to handle disabled_fpreg\n");
    3.17 -		dis_foo();
    3.18  		break;
    3.19  	    case 26:
    3.20  printf("*** NaT fault... attempting to handle as privop\n");