]> xenbits.xensource.com Git - people/gdunlap/xen.git/commitdiff
x86/domctl: improve XEN_DOMCTL_hypercall_init error handling
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 13 Mar 2015 15:31:27 +0000 (16:31 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 13 Mar 2015 15:31:27 +0000 (16:31 +0100)
EACCES cannot be distinguished against an incorrect DOMCTL_INTERFACE_VERSION,
and will cause an incorrect "need to rebuild the user-space tool set?" message
from libxc.

On the libxc side, put the useful piece of information in the error message,
rathe than the -1 from do_domctl().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/xc_dom_boot.c
xen/arch/x86/domctl.c

index a141eb5c0fac08333868efa388336f8ef33357d5..f82db2d8920f5f236963ed1ba4e00ea63791c59d 100644 (file)
@@ -57,9 +57,9 @@ static int setup_hypercall_page(struct xc_dom_image *dom)
     domctl.u.hypercall_init.gmfn = xc_dom_p2m_guest(dom, pfn);
     rc = do_domctl(dom->xch, &domctl);
     if ( rc != 0 )
-        xc_dom_panic(dom->xch,
-                     XC_INTERNAL_ERROR, "%s: HYPERCALL_INIT failed (rc=%d)",
-                     __FUNCTION__, rc);
+        xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                     "%s: HYPERCALL_INIT failed: %d - %s)",
+                     __FUNCTION__, errno, strerror(errno));
     return rc;
 }
 
index 3e5bef1c240db87c0a3d856de3f12feb08198381..d4f6ccf435dcd848acb1fa625c37ced687d73696 100644 (file)
@@ -386,16 +386,18 @@ long arch_do_domctl(
 
         page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC);
 
-        ret = -EACCES;
         if ( !page || !get_page_type(page, PGT_writable_page) )
         {
             if ( page )
+            {
+                ret = -EPERM;
                 put_page(page);
+            }
+            else
+                ret = -EINVAL;
             break;
         }
 
-        ret = 0;
-
         hypercall_page = __map_domain_page(page);
         hypercall_page_initialise(d, hypercall_page);
         unmap_domain_page(hypercall_page);