* [Qemu-devel] [RFC] Check backing_file chain's loop
@ 2013-05-30 10:14 Dongxu Wang
2013-05-30 12:12 ` Eric Blake
0 siblings, 1 reply; 4+ messages in thread
From: Dongxu Wang @ 2013-05-30 10:14 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf@redhat.com, stefanha
Hi,
Now block layer does not check whether backing_file chain can be a
circle, do you think it is necessary to do a check?
For example, 1.qcow2's backing_file is 2.qcow2 and 2.qcow2's
backing_file is 1.qcow2, then any IO operation will be a fault.
If necessary, I will post a patch to fix.
[$] qemu-img create -f qcow2 1.qcow2
qemu-img: Image creation needs a size parameter
[$] qemu-img create -f qcow2 1.qcow2 8M
Formatting '1.qcow2', fmt=qcow2 size=8388608 encryption=off
cluster_size=65536 lazy_refcounts=off
[$] qemu-img create -f qcow2 2.qcow2 -o backing_file=1.qcow2
Formatting '2.qcow2', fmt=qcow2 size=8388608 backing_file='1.qcow2'
encryption=off cluster_size=65536 lazy_refcounts=off
[$] qemu-img create -f qcow2 1.qcow2 -o backing_file=2.qcow2
Formatting '1.qcow2', fmt=qcow2 size=8388608 backing_file='2.qcow2'
encryption=off cluster_size=65536 lazy_refcounts=off
[$] qemu-io -c "read -v 0 512" 1.qcow2
^CSegmentation fault (core dumped)
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [RFC] Check backing_file chain's loop
2013-05-30 10:14 [Qemu-devel] [RFC] Check backing_file chain's loop Dongxu Wang
@ 2013-05-30 12:12 ` Eric Blake
2013-05-30 12:48 ` Stefan Hajnoczi
0 siblings, 1 reply; 4+ messages in thread
From: Eric Blake @ 2013-05-30 12:12 UTC (permalink / raw)
To: Dongxu Wang; +Cc: kwolf@redhat.com, qemu-devel, stefanha
[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]
On 05/30/2013 04:14 AM, Dongxu Wang wrote:
> Hi,
>
> Now block layer does not check whether backing_file chain can be a
> circle, do you think it is necessary to do a check?
>
> For example, 1.qcow2's backing_file is 2.qcow2 and 2.qcow2's
> backing_file is 1.qcow2, then any IO operation will be a fault.
>
> If necessary, I will post a patch to fix.
Yes, it's worth patching.
>
> [$] qemu-img create -f qcow2 1.qcow2
> qemu-img: Image creation needs a size parameter
> [$] qemu-img create -f qcow2 1.qcow2 8M
> Formatting '1.qcow2', fmt=qcow2 size=8388608 encryption=off
> cluster_size=65536 lazy_refcounts=off
> [$] qemu-img create -f qcow2 2.qcow2 -o backing_file=1.qcow2
> Formatting '2.qcow2', fmt=qcow2 size=8388608 backing_file='1.qcow2'
> encryption=off cluster_size=65536 lazy_refcounts=off
> [$] qemu-img create -f qcow2 1.qcow2 -o backing_file=2.qcow2
> Formatting '1.qcow2', fmt=qcow2 size=8388608 backing_file='2.qcow2'
> encryption=off cluster_size=65536 lazy_refcounts=off
> [$] qemu-io -c "read -v 0 512" 1.qcow2
> ^CSegmentation fault (core dumped)
Also make sure that 'qemu-img info 1.qcow2' and 'qemu-img info
--backing-chain 1.qcow2' don't crash.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [RFC] Check backing_file chain's loop
2013-05-30 12:12 ` Eric Blake
@ 2013-05-30 12:48 ` Stefan Hajnoczi
2013-05-31 2:17 ` Dongxu Wang
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2013-05-30 12:48 UTC (permalink / raw)
To: Eric Blake; +Cc: kwolf@redhat.com, Dongxu Wang, qemu-devel, stefanha
On Thu, May 30, 2013 at 06:12:00AM -0600, Eric Blake wrote:
> On 05/30/2013 04:14 AM, Dongxu Wang wrote:
> > Hi,
> >
> > Now block layer does not check whether backing_file chain can be a
> > circle, do you think it is necessary to do a check?
> >
> > For example, 1.qcow2's backing_file is 2.qcow2 and 2.qcow2's
> > backing_file is 1.qcow2, then any IO operation will be a fault.
> >
> > If necessary, I will post a patch to fix.
>
> Yes, it's worth patching.
>
> >
> > [$] qemu-img create -f qcow2 1.qcow2
> > qemu-img: Image creation needs a size parameter
> > [$] qemu-img create -f qcow2 1.qcow2 8M
> > Formatting '1.qcow2', fmt=qcow2 size=8388608 encryption=off
> > cluster_size=65536 lazy_refcounts=off
> > [$] qemu-img create -f qcow2 2.qcow2 -o backing_file=1.qcow2
> > Formatting '2.qcow2', fmt=qcow2 size=8388608 backing_file='1.qcow2'
> > encryption=off cluster_size=65536 lazy_refcounts=off
> > [$] qemu-img create -f qcow2 1.qcow2 -o backing_file=2.qcow2
> > Formatting '1.qcow2', fmt=qcow2 size=8388608 backing_file='2.qcow2'
> > encryption=off cluster_size=65536 lazy_refcounts=off
> > [$] qemu-io -c "read -v 0 512" 1.qcow2
> > ^CSegmentation fault (core dumped)
>
> Also make sure that 'qemu-img info 1.qcow2' and 'qemu-img info
> --backing-chain 1.qcow2' don't crash.
qemu-img info --backing-chain detects cycles and returns an error, see
the hash table in collect_image_info_list().
We should protect bdrv_open() too.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [RFC] Check backing_file chain's loop
2013-05-30 12:48 ` Stefan Hajnoczi
@ 2013-05-31 2:17 ` Dongxu Wang
0 siblings, 0 replies; 4+ messages in thread
From: Dongxu Wang @ 2013-05-31 2:17 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: kwolf@redhat.com, qemu-devel, stefanha
On 2013/5/30 20:48, Stefan Hajnoczi wrote:
>> hain 1.qcow2' don't crash.
> qemu-img info --backing-chain detects cycles and returns an error, see
> the hash table in collect_image_info_list().
>
> We should protect bdrv_open() too.
>
Okay, will send a patch.
> Stefan
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-31 2:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 10:14 [Qemu-devel] [RFC] Check backing_file chain's loop Dongxu Wang
2013-05-30 12:12 ` Eric Blake
2013-05-30 12:48 ` Stefan Hajnoczi
2013-05-31 2:17 ` Dongxu Wang
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).