qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vmdk: refuse to open higher version than supported
@ 2013-06-09  1:44 Fam Zheng
  2013-06-10  9:09 ` Stefan Hajnoczi
  2013-06-10  9:09 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Fam Zheng @ 2013-06-09  1:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, jcody, Fam Zheng, stefanha

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.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/vmdk.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block/vmdk.c b/block/vmdk.c
index 608daaf..d9c2368 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -558,6 +558,10 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
         header = footer.header;
     }
 
+    if (le32_to_cpu(header.version) >= 3) {
+        return -EINVAL;
+    }
+
     l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte)
                         * le64_to_cpu(header.granularity);
     if (l1_entry_sectors == 0) {
-- 
1.8.3 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] vmdk: refuse to open higher version than supported
  2013-06-09  1:44 [Qemu-devel] [PATCH] vmdk: refuse to open higher version than supported Fam Zheng
@ 2013-06-10  9:09 ` Stefan Hajnoczi
  2013-06-10  9:09 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-06-10  9:09 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, jcody, qemu-devel, stefanha

On Sun, Jun 09, 2013 at 09:44:15AM +0800, Fam Zheng wrote:
> 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.

The best I could find was this high-level overview:
http://myvirtualcloud.net/?p=3829

> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/vmdk.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 608daaf..d9c2368 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -558,6 +558,10 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
>          header = footer.header;
>      }
>  
> +    if (le32_to_cpu(header.version) >= 3) {
> +        return -EINVAL;
> +    }
> +

Looks fine, the VMDK 5.0 spec says header.version may be 1 or 2.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] vmdk: refuse to open higher version than supported
  2013-06-09  1:44 [Qemu-devel] [PATCH] vmdk: refuse to open higher version than supported Fam Zheng
  2013-06-10  9:09 ` Stefan Hajnoczi
@ 2013-06-10  9:09 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2013-06-10  9:09 UTC (permalink / raw)
  To: Fam Zheng; +Cc: jcody, qemu-devel, stefanha

Am 09.06.2013 um 03:44 hat Fam Zheng geschrieben:
> 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.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Yes, it's definitely a good idea to add a check.

> @@ -558,6 +558,10 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
>          header = footer.header;
>      }
>  
> +    if (le32_to_cpu(header.version) >= 3) {
> +        return -EINVAL;
> +    }
> +

Other block drivers return -ENOTSUP for this case, and also call
qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, ...) so that you get a
meaningful error message. Can you model the VMDK code after them?

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-10  9:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-09  1:44 [Qemu-devel] [PATCH] vmdk: refuse to open higher version than supported Fam Zheng
2013-06-10  9:09 ` Stefan Hajnoczi
2013-06-10  9:09 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).