File 551bb769-domctl-don-t-allow-a-toolstack-domain-to-domain_pause-itself.patch of Package xen.openSUSE_13.1_Update

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1427879729 -3600
# Node ID e7824433c85b899c01fab5aa0c3027dedcdd0a3f
# Parent  e944e9f189315d6e13b48e7efb1733b25be24791
domctl: don't allow a toolstack domain to call domain_pause() on itself

These DOMCTL subops were accidentally declared safe for disaggregation
in the wake of XSA-77.

This is XSA-127 / CVE-2015-2751.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

Index: xen-4.3.4-testing/xen/arch/x86/domctl.c
===================================================================
--- xen-4.3.4-testing.orig/xen/arch/x86/domctl.c
+++ xen-4.3.4-testing/xen/arch/x86/domctl.c
@@ -941,6 +941,10 @@ long arch_do_domctl(
     {
         xen_guest_tsc_info_t info;
 
+        ret = -EINVAL;
+        if ( d == current->domain ) /* no domain_pause() */
+            break;
+
         domain_pause(d);
         tsc_get_info(d, &info.tsc_mode,
                         &info.elapsed_nsec,
@@ -956,6 +960,10 @@ long arch_do_domctl(
 
     case XEN_DOMCTL_settscinfo:
     {
+        ret = -EINVAL;
+        if ( d == current->domain ) /* no domain_pause() */
+            break;
+
         domain_pause(d);
         tsc_set_info(d, domctl->u.tsc_info.info.tsc_mode,
                      domctl->u.tsc_info.info.elapsed_nsec,
Index: xen-4.3.4-testing/xen/common/domctl.c
===================================================================
--- xen-4.3.4-testing.orig/xen/common/domctl.c
+++ xen-4.3.4-testing/xen/common/domctl.c
@@ -391,8 +391,10 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
 
     case XEN_DOMCTL_resumedomain:
     {
-        domain_resume(d);
-        ret = 0;
+        if ( d == current->domain ) /* no domain_pause() */
+            ret = -EINVAL;
+        else
+            domain_resume(d);
     }
     break;
 
openSUSE Build Service is sponsored by