x86/domctl: don't allow a toolstack domain to pause itself
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 21 Apr 2015 07:05:26 +0000 (09:05 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 21 Apr 2015 07:05:26 +0000 (09:05 +0200)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/arch/x86/domctl.c

index b6df23ab91564da328e192c579df490422716453..20cdccb111fb3a9f1aa497cf85f66b0b0ca54fb7 100644 (file)
@@ -411,7 +411,8 @@ long arch_do_domctl(
         struct hvm_domain_context c = { .size = domctl->u.hvmcontext.size };
 
         ret = -EINVAL;
-        if ( !is_hvm_domain(d) )
+        if ( (d == currd) || /* no domain_pause() */
+             !is_hvm_domain(d) )
             goto sethvmcontext_out;
 
         ret = -ENOMEM;
@@ -436,7 +437,8 @@ long arch_do_domctl(
         struct hvm_domain_context c = { 0 };
 
         ret = -EINVAL;
-        if ( !is_hvm_domain(d) )
+        if ( (d == currd) || /* no domain_pause() */
+             !is_hvm_domain(d) )
             goto gethvmcontext_out;
 
         c.size = hvm_save_size(d);
@@ -475,7 +477,8 @@ long arch_do_domctl(
 
     case XEN_DOMCTL_gethvmcontext_partial:
         ret = -EINVAL;
-        if ( !is_hvm_domain(d) )
+        if ( (d == currd) || /* no domain_pause() */
+             !is_hvm_domain(d) )
             break;
 
         domain_pause(d);
@@ -894,7 +897,8 @@ long arch_do_domctl(
             break;
 
         ret = -EINVAL;
-        if ( !is_hvm_domain(d))
+        if ( (v == curr) || /* no vcpu_pause() */
+             !is_hvm_domain(d) )
             break;
 
         ret = hvm_debug_op(v, domctl->u.debug_op.op);