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

[Xen-changelog] [xen-unstable] [XEN] Shadow: be more explicit in assuming that d->vcpu[0] is valid



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1173442229 0
# Node ID 26e034395b8e045abb78849ca9369780c3871cfb
# Parent  101a1ccfc3f7c95d25188d058e653bbd895a1c3a
[XEN] Shadow: be more explicit in assuming that d->vcpu[0] is valid
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/common.c |   14 ++++++++++++--
 xen/include/asm-x86/paging.h    |    2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff -r 101a1ccfc3f7 -r 26e034395b8e xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Fri Mar 09 11:45:49 2007 +0000
+++ b/xen/arch/x86/mm/shadow/common.c   Fri Mar 09 12:10:29 2007 +0000
@@ -802,7 +802,7 @@ void shadow_prealloc(struct domain *d, u
     v = current;
     if ( v->domain != d )
         v = d->vcpu[0];
-    ASSERT(v != NULL);
+    ASSERT(v != NULL); /* Shouldn't have enabled shadows if we've no vcpus  */
 
     /* Stage one: walk the list of pinned pages, unpinning them */
     perfc_incrc(shadow_prealloc_1);
@@ -861,7 +861,9 @@ static void shadow_blow_tables(struct do
     struct vcpu *v = d->vcpu[0];
     mfn_t smfn;
     int i;
-    
+
+    ASSERT(v != NULL);
+
     /* Pass one: unpin all pinned pages */
     list_for_each_backwards_safe(l,t, &d->arch.paging.shadow.pinned_shadows)
     {
@@ -2384,6 +2386,7 @@ int shadow_enable(struct domain *d, u32 
 
     /* Sanity check the arguments */
     if ( (d == current->domain) ||
+         d->vcpu[0] == NULL ||
          shadow_mode_enabled(d) ||
          ((mode & PG_translate) && !(mode & PG_refcounts)) ||
          ((mode & PG_external) && !(mode & PG_translate)) )
@@ -2991,6 +2994,13 @@ int shadow_domctl(struct domain *d,
         gdprintk(XENLOG_INFO, "Ignoring shadow op on dying domain %u\n",
                  d->domain_id);
         return 0;
+    }
+
+    if ( unlikely(d->vcpu[0] == NULL) )
+    {
+        SHADOW_ERROR("Shadow op on a domain (%u) with no vcpus\n",
+                     d->domain_id);
+        return -EINVAL;
     }
 
     switch ( sc->op )
diff -r 101a1ccfc3f7 -r 26e034395b8e xen/include/asm-x86/paging.h
--- a/xen/include/asm-x86/paging.h      Fri Mar 09 11:45:49 2007 +0000
+++ b/xen/include/asm-x86/paging.h      Fri Mar 09 12:10:29 2007 +0000
@@ -273,7 +273,7 @@ static inline void paging_write_p2m_entr
     struct vcpu *v = current;
     if ( v->domain != d )
         v = d->vcpu[0];
-    if ( likely(paging_mode_enabled(d) && v->arch.paging.mode != NULL) )
+    if ( likely(v && paging_mode_enabled(d) && v->arch.paging.mode != NULL) )
     {
         return v->arch.paging.mode->write_p2m_entry(v, gfn, p, new, level);
     }

_______________________________________________
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®.