Skip to contentSkip to conversation

XSA-175/XSA-178 followups

PATCH In review Ian Jackson 2 participants 6 messages Jun 2, 2016

lore
Share & tools
lore
#0 lore raw

cover XSA-175/XSA-178 followups

These three patches came out of my development of the XSA-175/XSA-178 fixes.

The rest of the XSA-175/XSA-178 patches, as sent out in the advisory, have just been applied to staging. These three patches have not, yet.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw

PATCH 1/3 libxl: Cleanup: Have libxl__alloc_vdev use /libxl

When allocating a vdev for a new disk, look in /libxl/device, rather than the frontends directory in xenstore.

This is more in line with the other parts of libxl, which ought not to trust frontends. In this case, though, there is no security bug prior to this patch because the frontend is the toolstack domain itself.

If libxl__alloc_vdev were ever changed to take a frontend domain argument, this patch will fix a latent security bug.

This is a followup to XSA-175.

---
 tools/libxl/libxl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/libxl/libxl.c +2 -2
index 9ff08a5..d5475ed 100644
@@ -3105,7 +3105,7 @@ static char * libxl__alloc_vdev(libxl__gc *gc, void *get_vdev_user,
 {
     const char *blkdev_start = (const char *) get_vdev_user;
     int devid = 0, disk = 0, part = 0;
-    char *dompath = libxl__xs_get_dompath(gc, LIBXL_TOOLSTACK_DOMID);
+    char *libxl_dom_path = libxl__xs_libxl_path(gc, LIBXL_TOOLSTACK_DOMID);
 
     libxl__device_disk_dev_number(blkdev_start, &disk, &part);
     if (part != 0) {
@@ -3120,7 +3120,7 @@ static char * libxl__alloc_vdev(libxl__gc *gc, void *get_vdev_user,
             return NULL;
         if (libxl__xs_read(gc, t,
                     GCSPRINTF("%s/device/vbd/%d/backend",
-                        dompath, devid)) == NULL) {
+                        libxl_dom_path, devid)) == NULL) {
             if (errno == ENOENT)
                 return libxl__devid_to_vdev(gc, devid);
             else
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw

PATCH 2/3 libxl: Cleanup: use libxl__backendpath_parse_domid in libxl__device_disk_from_xs_be

In reply to Ian Jackson

Rather than an open-coded sscanf. No functional change with correct input.

This is a followup to XSA-175 and XSA-178.

---
 tools/libxl/libxl.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/libxl/libxl.c +3 -3
index d5475ed..006b83f 100644
@@ -2658,10 +2658,10 @@ static int libxl__device_disk_from_xenstore(libxl__gc *gc,
         goto out;
     }
 
-    rc = sscanf(backend_path, "/local/domain/%d/", &disk->backend_domid);
-    if (rc != 1) {
+    rc = libxl__backendpath_parse_domid(gc, backend_path, &disk->backend_domid);
+    if (rc) {
         LOG(ERROR, "Unable to fetch device backend domid from %s", backend_path);
-        goto cleanup;
+        goto out;
     }
 
     /*
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw

PATCH 3/3 libxl: Document ~/serial/ correctly

In reply to Ian Jackson

xenstore-paths.markdown talked about ~/device/serial/, but that's not used.

(It is very wrong for this value, which contains a driver domain filesystem path, to be in the guest's area of xenstore. However, it is only ever created by libxl and ready by xenconsoled. When it is created, it inherits the read-only permissions of /local/domain/DOMID. So there is no security bug.)

This is a followup to XSA-175.

---
 docs/misc/xenstore-paths.markdown |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docs/misc/xenstore-paths.markdown +1 -1
index 261ee42..c6b4dab 100644
@@ -283,7 +283,7 @@ The primary PV console device. Described in [console.txt](console.txt)
 
 A secondary PV console device. Described in [console.txt](console.txt)
 
-#### ~/device/serial/$DEVID/* [HVM]
+#### ~/serial/$DEVID/* [HVM]
 
 An emulated serial device. Described in [console.txt](console.txt)
 
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#4 lore raw
In reply to Ian Jackson
Quoted 6 lines · Ian Jackson

These three patches came out of my development of the XSA-175/XSA-178 fixes.

The rest of the XSA-175/XSA-178 patches, as sent out in the advisory, have just been applied to staging. These three patches have not, yet.

Please apply these three to staging as well.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
Quoted 11 lines · Wei Liu
Quoted 6 lines · Ian Jackson

These three patches came out of my development of the XSA-175/XSA-178 fixes.

The rest of the XSA-175/XSA-178 patches, as sent out in the advisory, have just been applied to staging. These three patches have not, yet.

Please apply these three to staging as well.

I've queued this series up for committing.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel