All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "Stefan Weil" <sw@weilnetz.de>,
	qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Benoît Canet" <benoit.canet@nodalink.com>
Subject: Re: [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error
Date: Thu, 23 Oct 2014 15:24:16 +0200	[thread overview]
Message-ID: <54490180.8070104@redhat.com> (raw)
In-Reply-To: <5448A928.50603@redhat.com>

On 2014-10-23 at 09:07, Max Reitz wrote:
> On 2014-10-22 at 13:56, Kevin Wolf wrote:
>> Am 21.10.2014 um 10:51 hat Max Reitz geschrieben:
>>> The bmap size in block/vdi.c may exceed INT_MAX. Using
>>> bdrv_pwrite_sync() (which takes an int byte count) is therefore not a
>>> good idea. The second patch of this series fixes this by replacing
>>> bdrv_pwrite_sync() by bdrv_write()+bdrv_flush() (we don't need the p in
>>> pwrite here).
>>>
>>> The first patch employs ROUND_UP() and DIV_ROUND_UP() in 
>>> block/vdi.c, so
>>> you are reminded that bmap_size is aligned to BDRV_SECTOR_SIZE for the
>>> second patch.
>>>
>>> See https://bugzilla.redhat.com/show_bug.cgi?id=1154940 for a bug
>>> report.
>>>
>>> I will not include an iotest in this series because this would require
>>> qemu to allocate and then write about 2G of data; yes, test 1 in 084
>>> fails for me because qemu cannot allocate 4G for the bmap.
>>>
>>> In fact, I can only test this once I'm home where I have more RAM
>>> available (I made the mistake of activating swap space to test this 
>>> only
>>> once).
>> Thanks, applied to the block branch.
>
> So I tested it yesterday and it turns out it does not fix the bug. I'm 
> sorry, could you unapply patch 2?

I see you haven't dropped it yet. Well, I just thought about it and of 
course we can keep it in. It just doesn't fix the error its commit 
message pretends to, but it definitely doesn't make matters worse.

Max

> The reason it doesn't work is, as you personally said to me yesterday, 
> that bdrv_write() goes through the bdrv_pwrite() path as well. Well, 
> it does not really, but it does test whether nb_sectors > INT_MAX / 
> BDRV_SECTOR_SIZE. Therefore, writing the bitmap still fails with 
> EINVAL (for images >= 512 TB).
>
> Now, we could either actually fix the VDI code; or we simply limit the 
> maximum image size to half what it is now. I don't see a problem in 
> doing the latter, since qemu already does not support all image sizes, 
> so there's no reason why we should not limit the size even further. 
> Also, 512 TB seems plenty today.
>
> So unless someone is against this, I'll adjust VDI_BLOCKS_IN_IMAGE to 
> be INT_MAX / sizeof(uint32_t) (it's currently UINT32_MAX / 
> sizeof(uint32_t) == 0x3fffffff). This will be problematic if 
> sizeof(int) > sizeof(uint32_t), but I doubt that'll happen soon, if at 
> all.
>
> Max

      reply	other threads:[~2014-10-23 13:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21  8:51 [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error Max Reitz
2014-10-21  8:51 ` [Qemu-devel] [PATCH 1/2] block/vdi: Use {DIV_,}ROUND_UP Max Reitz
2014-10-21 16:58   ` Eric Blake
2014-10-21  8:51 ` [Qemu-devel] [PATCH 2/2] block/vdi: Do not use bdrv_pwrite_sync() for bmap Max Reitz
2014-10-21 17:00   ` Eric Blake
2014-10-22 11:56 ` [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error Kevin Wolf
2014-10-23  7:07   ` Max Reitz
2014-10-23  7:07   ` Max Reitz
2014-10-23 13:24     ` Max Reitz [this message]

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=54490180.8070104@redhat.com \
    --to=mreitz@redhat.com \
    --cc=benoit.canet@nodalink.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=sw@weilnetz.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.