qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Eric Blake <eblake@redhat.com>
Cc: Xu Wang <cngesaint@gmail.com>, Xu Wang <cngesaint@outlook.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] Refine and export infinite loop checking in collect_image_info_list()
Date: Thu, 4 Jul 2013 15:00:20 +0200	[thread overview]
Message-ID: <20130704130020.GF4213@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <51CDF420.60202@redhat.com>

On Fri, Jun 28, 2013 at 02:37:52PM -0600, Eric Blake wrote:
> On 06/27/2013 01:38 AM, Xu Wang wrote:
> > +    filenames = g_hash_table_new_full(g_str_hash, str_equal_func, NULL, NULL);
> > +
> > +    /* If backing file exists, filename will insert into hash table and seek
> > +     * the whole backing file chain from @backing_file.
> > +     */
> > +    if (backing_file) {
> > +        g_hash_table_insert(filenames, (gpointer)filename, NULL);
> 
> Does this have any false positives (perhaps mishandling due to relative
> names) or false negatives (perhaps hard links allow different spellings
> of the same file to create a loop, although the difference in names
> won't indicate the problem)?  I'd really like to see you add a testcase
> before this patch gets committed, although I agree that a patch along
> these lines is worthwhile.  For example, make sure the following chain
> is not rejected:
> 
> /dir1/base.img <- /dir1/wrap.img(relative backing 'base.img') <-
> /dir2/base.img (absolute backing '/dir1/base.img') <-
> /dir2/wrap.img(relative backing 'base.img')
> 
> whether opened in /dir2/ via relative name 'wrap.img' or absolute name
> '/dir2/wrap.img'.  Likewise, make sure you can detect this loop:
> 
> create directory 'dir'
> create './dir/b.img'
> create './b.img' with relative backing 'dir/b.img'
> remove ./dir/b.img and dir
> ln -s . dir
> now 'b.img' refers to itself as backing file, even though the names
> ./b.img and ./dir/b.img are not equal by strcmp.

Yes, a test case should be added in tests/qemu-iotests/.  Please see
this wiki page for documentation:

http://qemu-project.org/Documentation/QemuIoTests

Stefan

  reply	other threads:[~2013-07-04 13:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27  7:38 [Qemu-devel] [PATCH 0/2] Add infinite loop checking in img_create() Xu Wang
2013-06-27  7:38 ` [Qemu-devel] [PATCH 1/2] Refine and export infinite loop checking in collect_image_info_list() Xu Wang
2013-06-28 20:37   ` Eric Blake
2013-07-04 13:00     ` Stefan Hajnoczi [this message]
2013-07-08  7:31     ` Xu Wang
2013-06-27  7:38 ` [Qemu-devel] [PATCH 2/2] Check infinite loop in img_create() Xu Wang
2013-06-29 14:32 ` [Qemu-devel] [PATCH 0/2] Add infinite loop checking " Andreas Färber
2013-07-04 13:01   ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130704130020.GF4213@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=cngesaint@gmail.com \
    --cc=cngesaint@outlook.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).