File 20289-shadow-shutdown-fault-inject.patch of Package xen

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1254927365 -3600
# Node ID e1cac8e4bdeb9c02a6f936e060d625ffa8cb09e3
# Parent  f9cbb5a274d668e54ab6cdf00d88a1b7da665514
x86 shadow: fix the check for having killed the guest in the fault handler.

We care only about when we have called domain_crash() (and therefore
shadow invariants may not hold) and shouldn't spuriously inject
pagefaults into guests that are shutting down for other reasons.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1254929343 -3600
# Node ID 729567f615c1a61bbe0ab0d36537b3abb5bf4e0f
# Parent  5cb466187e1f5827c14fcb05e4a7c4dab0f2b441
x86 shadow: Fix the build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>

--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -35,6 +35,7 @@
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/cacheattr.h>
 #include <asm/mtrr.h>
+#include <public/sched.h>
 #include "private.h"
 #include "types.h"
 
@@ -3230,7 +3231,7 @@ static int sh_page_fault(struct vcpu *v,
      * already used for some special purpose (ioreq pages, or granted pages).
      * If that happens we'll have killed the guest already but it's still not 
      * safe to propagate entries out of the guest PT so get out now. */
-    if ( unlikely(d->is_shutting_down) )
+    if ( unlikely(d->is_shutting_down && d->shutdown_code == SHUTDOWN_crash) )
     {
         SHADOW_PRINTK("guest is shutting down\n");
         return 0;
@@ -3327,7 +3328,7 @@ static int sh_page_fault(struct vcpu *v,
          && ft == ft_demand_write )
         sh_unsync(v, gmfn);
 
-    if ( unlikely(d->is_shutting_down) )
+    if ( unlikely(d->is_shutting_down && d->shutdown_code == SHUTDOWN_crash) )
     {
         /* We might end up with a crashed domain here if
          * sh_remove_shadows() in a previous sh_resync() call has
openSUSE Build Service is sponsored by