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-changelog

[Xen-changelog] [xen-unstable] [XEN] Shadow: be more explicit in assumin

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Shadow: be more explicit in assuming that d->vcpu[0] is valid
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 09 Mar 2007 11:30:28 -0800
Delivery-date: Fri, 09 Mar 2007 11:30:54 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] Shadow: be more explicit in assuming that d->vcpu[0] is valid, Xen patchbot-unstable <=