Skip to contentSkip to conversation

vmdk: refuse to open higher version than supported

PATCH Applied Fam Zheng 2 participants 4 messages Jun 13, 2013 – Jun 24, 2013 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH v2 1/1 vmdk: refuse to open higher version than supported

Refuse to open higher version for safety.

Although we try to be compatible with published VMDK spec, VMware has newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge what's changed in it. And it is very likely to have more new versions in the future, so it's not safe to open them blindly.

---

v2: Report error and return -ENOTSUP.

---
 block/vmdk.c | 9 +++++++++
 1 file changed, 9 insertions(+)
block/vmdk.c +9 -0
index 608daaf..9dda2f5 100644
@@ -558,6 +558,15 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
         header = footer.header;
     }
 
+    if (le32_to_cpu(header.version) >= 3) {
+        char buf[64];
+        snprintf(buf, sizeof(buf), "VMDK version %d",
+                 le32_to_cpu(header.version));
+        qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
+                bs->device_name, "vmdk", buf);
+        return -ENOTSUP;
+    }
+
     l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte)
                         * le64_to_cpu(header.granularity);
     if (l1_entry_sectors == 0) {
Signature · 1 line
1.8.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Fam Zheng

Refuse to open higher version for safety.

Although we try to be compatible with published VMDK spec, VMware has newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge what's changed in it. And it is very likely to have more new versions in the future, so it's not safe to open them blindly.

Quoted 7 lines

---

v2: Report error and return -ENOTSUP.

---
 block/vmdk.c | 9 +++++++++
 1 file changed, 9 insertions(+)
author
#2 lore raw
Quoted 12 lines · Stefan Hajnoczi
Quoted 11 lines · Fam Zheng

Refuse to open higher version for safety.

Although we try to be compatible with published VMDK spec, VMware has newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge what's changed in it. And it is very likely to have more new versions in the future, so it's not safe to open them blindly.

---

Quoted 7 lines
Quoted 5 lines

v2: Report error and return -ENOTSUP.

---
 block/vmdk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Is this OK to be applied? Thanks.

Signature · 1 line
Fam
#3 lore raw
In reply to Fam Zheng
Quoted 9 lines · Fam Zheng

Refuse to open higher version for safety.

Although we try to be compatible with published VMDK spec, VMware has newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge what's changed in it. And it is very likely to have more new versions in the future, so it's not safe to open them blindly.

Quoted 7 lines

---

v2: Report error and return -ENOTSUP.

---
 block/vmdk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan