]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: Do not trust backend for vtpm in getinfo (except uuid)
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 29 Apr 2016 16:18:44 +0000 (17:18 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 6 Jun 2016 16:11:28 +0000 (17:11 +0100)
* Do not check the backend for existence.  We have already read the
  /libxl path so know that the vtpm exists (or is supposed to); if the
  backend doesn't exist then that must be the backend's doing.
* Get the frontend path from the /libxl directory.
* The frontend domid is the guest domid, and does not need to be read
  from xenstore (!)

We still attempt to read the uuid from the backend.  This will be
fixed in the next patch.

This is part of XSA-178.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl.c

index b44009942354fb9ac918b59069b4e224665e74f9..6f96514aec348a76182a85f2f429f93b0c5239f1 100644 (file)
@@ -1925,9 +1925,6 @@ int libxl_device_vtpm_getinfo(libxl_ctx *ctx,
     if (!vtpminfo->backend) {
         goto err;
     }
-    if(!libxl__xs_read(gc, XBT_NULL, vtpminfo->backend)) {
-       goto err;
-    }
 
     rc = libxl__backendpath_parse_domid(gc, vtpminfo->backend,
                                         &vtpminfo->backend_id);
@@ -1946,11 +1943,8 @@ int libxl_device_vtpm_getinfo(libxl_ctx *ctx,
     vtpminfo->rref = val ? strtoul(val, NULL, 10) : -1;
 
     vtpminfo->frontend = xs_read(ctx->xsh, XBT_NULL,
-          GCSPRINTF("%s/frontend", vtpminfo->backend), NULL);
-
-    val = libxl__xs_read(gc, XBT_NULL,
-          GCSPRINTF("%s/frontend-id", vtpminfo->backend));
-    vtpminfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
+          GCSPRINTF("%s/frontend", libxl_path), NULL);
+    vtpminfo->frontend_id = domid;
 
     val = libxl__xs_read(gc, XBT_NULL,
           GCSPRINTF("%s/uuid", vtpminfo->backend));