x86/shadow: make 1-bit-disable match 1-bit-enable
authorJan Beulich <jbeulich@suse.com>
Wed, 20 Dec 2017 09:12:11 +0000 (10:12 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 20 Dec 2017 09:12:11 +0000 (10:12 +0100)
shadow_one_bit_enable() sets PG_SH_enable (if not already set of course)
in addition to the bit being requested. Make shadow_one_bit_disable()
behave similarly - clear PG_SH_enable if that's the only bit remaining.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/shadow/common.c

index 600df0cedc27c6464e3d043bccd491648a03ddd5..0e9e1912ca7dfed9f8886cfaeaa56a9565678595 100644 (file)
@@ -3377,7 +3377,10 @@ static int shadow_one_bit_disable(struct domain *d, u32 mode)
     }
 
     /* Update the bits */
-    sh_new_mode(d, d->arch.paging.mode & ~mode);
+    mode = d->arch.paging.mode & ~mode;
+    if ( mode == PG_SH_enable )
+        mode = 0;
+    sh_new_mode(d, mode);
     if ( d->arch.paging.mode == 0 )
     {
         /* Get this domain off shadows */