Skip to contentSkip to conversation

libxl: QED disks support

PATCH Superseded Cédric Bosdonnat 2 participants 4 messages Dec 12, 2016 – Dec 13, 2016

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 libxl: QED disks support

Qdisk supports qcow and qcow2, extend it to also support qed disk format.

---
v2:
* Add qed to the list for possible format values in xl-disk-configuration.txt
* Add LIBXL_HAVE_QED

v3:
* Remove the qed: obsolete prefix support

---
 docs/misc/xl-disk-configuration.txt |    2 +-
 tools/libxl/libxl.h                 |    7 +
 tools/libxl/libxl_device.c          |    1 +
 tools/libxl/libxl_dm.c              |    1 +
 tools/libxl/libxl_types.idl         |    1 +
 tools/libxl/libxl_utils.c           |    2 +
 tools/libxl/libxlu_disk_l.c         | 1018 ++++++++++++++++++-----------------
 tools/libxl/libxlu_disk_l.h         |   53 +-
 tools/libxl/libxlu_disk_l.l         |    1 +
 9 files changed, 546 insertions(+), 540 deletions(-)
docs/misc/xl-disk-configuration.txt +1 -1
index b3402bc33a..926889b23d 100644
@@ -87,7 +87,7 @@ format
 ------
 
 Description:           Specifies the format of image file.
-Supported values:      raw, qcow, qcow2, vhd
+Supported values:      raw, qcow, qcow2, vhd, qed
 Deprecated values:     None
 Default value:         raw
 
tools/libxl/libxl.h +7 -0
index acbf47690e..3924464588 100644
@@ -1012,6 +1012,13 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  */
 #define LIBXL_HAVE_MEMKB_64BITS 1
 
+/*
+ * LIBXL_HAVE_QED
+ *
+ * If this is defined QED disk formats can be used for both HVM and PV guests.
+ */
+#define LIBXL_HAVE_QED 1
+
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
 int libxl_string_list_length(const libxl_string_list *sl);
tools/libxl/libxl_device.c +1 -0
index 3e7a1026c4..6c34141072 100644
@@ -411,6 +411,7 @@ char *libxl__device_disk_string_of_format(libxl_disk_format format)
         case LIBXL_DISK_FORMAT_VHD: return "vhd";
         case LIBXL_DISK_FORMAT_RAW:
         case LIBXL_DISK_FORMAT_EMPTY: return "aio";
+        case LIBXL_DISK_FORMAT_QED: return "qed";
         default: return NULL;
     }
 }
tools/libxl/libxl_dm.c +1 -0
index ad366a8cd3..8b373422f1 100644
@@ -677,6 +677,7 @@ static const char *qemu_disk_format_string(libxl_disk_format format)
     case LIBXL_DISK_FORMAT_VHD: return "vpc";
     case LIBXL_DISK_FORMAT_RAW: return "raw";
     case LIBXL_DISK_FORMAT_EMPTY: return NULL;
+    case LIBXL_DISK_FORMAT_QED: return "qed";
     default: return NULL;
     }
 }
tools/libxl/libxl_types.idl +1 -0
index a32c751b0e..a612d1f4ff 100644
@@ -114,6 +114,7 @@ libxl_disk_format = Enumeration("disk_format", [
     (3, "VHD"),
     (4, "RAW"),
     (5, "EMPTY"),
+    (6, "QED"),
     ])
 
 libxl_disk_backend = Enumeration("disk_backend", [
tools/libxl/libxl_utils.c +2 -0
index 49cbaa5b70..507ee56c7c 100644
@@ -317,6 +317,8 @@ int libxl_string_to_backend(libxl_ctx *ctx, char *s, libxl_disk_backend *backend
             *backend = LIBXL_DISK_BACKEND_QDISK;
         } else if (!strcmp(p, "qcow2")) {
             *backend = LIBXL_DISK_BACKEND_QDISK;
+        } else if (!strcmp(p, "qed")) {
+            *backend = LIBXL_DISK_BACKEND_QDISK;
         }
     }
 out:
tools/libxl/libxlu_disk_l.c +513 -505

1,655 lines not on this page · raw message

tools/libxl/libxlu_disk_l.h +19 -34

120 lines not on this page · raw message

tools/libxl/libxlu_disk_l.l +1 -0
index 5b6db221e4..97039a2800 100644
@@ -102,6 +102,7 @@ static void setformat(DiskParseContext *dpc, const char *str) {
     else if (!strcmp(str,"qcow2"))  DSET(dpc,format,FORMAT,str,QCOW2);
     else if (!strcmp(str,"vhd"))    DSET(dpc,format,FORMAT,str,VHD);
     else if (!strcmp(str,"empty"))  DSET(dpc,format,FORMAT,str,EMPTY);
+    else if (!strcmp(str,"qed"))    DSET(dpc,format,FORMAT,str,QED);
     else xlu__disk_err(dpc,str,"unknown value for format");
 }
 
Signature · 7 lines
2.11.0


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

Cédric Bosdonnat writes ("[PATCH v3] libxl: QED disks support"):

Quoted 2 lines

Qdisk supports qcow and qcow2, extend it to also support qed disk format.

The patch is good.

I have a qualm, though. I think this would increase our security support footprint to include the qemu qed disk format driver.

Specifically:

* Does the qed format contain a builtin way to refer to other files, like qcow does ? Paradoxically, if it does not, then it is a bigger risk for us: because then it might be reasonable for a user to feed an untrusted qed image file to xl, for use with a likewise-untrusted guest. That means that image-handling bugs in qed would be security bugs which we might have to do security response for.

* We should at least consider the possibility that qed might be vulnerable to anomalous guest behaviour. I don't know enough about qed to say much about that.

So I would be happy with this patch if it came with a hunk editing docs/misc/qemu-xen-security to say something like:

+ - backing storage image format: raw, qcow, qcow2, vhd

(And we might want to drop vhd...)

Ian.

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

#2 lore raw

Hi Ian,

Quoted 11 lines · Ian Jackson

Cédric Bosdonnat writes ("[PATCH v3] libxl: QED disks support"):

Quoted 2 lines

Qdisk supports qcow and qcow2, extend it to also support qed disk format.

The patch is good.

I have a qualm, though.  I think this would increase our security support footprint to include the qemu qed disk format driver.

Specifically:

Quoted 7 lines

 * Does the qed format contain a builtin way to refer to other files, like qcow does ?  Paradoxically, if it does not, then it is a bigger risk for us: because then it might be reasonable for a user to feed an untrusted qed image file to xl, for use with a likewise-untrusted guest.  That means that image-handling bugs in qed would be security bugs which we might have to do security response for.

QED does support backing files, not sure if this is a good or bad news on the security topic.

Quoted 10 lines

 * We should at least consider the possibility that qed might be vulnerable to anomalous guest behaviour.  I don't know enough about qed to say much about that.

So I would be happy with this patch if it came with a hunk editing docs/misc/qemu-xen-security to say something like:

 +  - backing storage image format: raw, qcow, qcow2, vhd

(And we might want to drop vhd...)

I'm not the one deciding what is supported and what is not. Just tell me what I should add in the patch regarding that and I'll add it.

--
Cedric

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

#3 lore raw

Cedric Bosdonnat writes ("Re: [PATCH v3] libxl: QED disks support"):

Quoted 11 lines · Ian Jackson
Quoted 9 lines

Specifically:

 * Does the qed format contain a builtin way to refer to other files, like qcow does ?  Paradoxically, if it does not, then it is a bigger risk for us: because then it might be reasonable for a user to feed an untrusted qed image file to xl, for use with a likewise-untrusted guest.  That means that image-handling bugs in qed would be security bugs which we might have to do security response for.

Quoted 2 lines

QED does support backing files, not sure if this is a good or bad news on the security topic.

It's bad news from on the general security front, because (if I understand you correctly) it means that a malicious QED image can cause qemu to access any file on the disk.

But it is good news from the point of view of the Xen Project Security Team because it means that any situation where a malicious QED image can cause qemu to malfunction cannot itself be a security bug :-).

Quoted 9 lines
Quoted 6 lines

So I would be happy with this patch if it came with a hunk editing docs/misc/qemu-xen-security to say something like:

 +  - backing storage image format: raw, qcow, qcow2, vhd

(And we might want to drop vhd...)

I'm not the one deciding what is supported and what is not. Just tell me what I should add in the patch regarding that and I'll add it.

Sure.

Please add, for now, this line:

- backing storage image format: raw, qcow, qcow2, vhd

to docs/misc/qemu-xen-security, after "- storage".

I am certainly open to being convinced that we should add qed to this list, but I would like someone who understands it to make the case (ie, explain why the risk is low).

Thanks,
Ian.

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