On Tue, 20 Sep 2016 11:59:28 +0200
Paolo Bonzini <pbonz...@redhat.com> wrote:
> On 20/09/2016 11:41, Tomáš Golembiovský wrote:
> > When image is part of the file it makes sense to limit the length of the
> > image in the file. Otherwise it is assumed that the image spans to the
> > end of the file. This assumption may lead to reads/writes outside of the
> > image and thus lead to errors or data corruption.
> > To limit the assumed image size new option is introduced.
> The patch makes sense, but I think the commit message is incorrect
> because this bug is already fixed by patch 1. Also, the option in the
I agree that the wording is not completely clear. The patches solve two
different but related problems. The first patch solves situation where
you have file containing:
|| some data ; image ||
In this case qemu-nbd tried to access data outside the file. But there
is nothing there, because the file is shorter.
The second patch tries to solve the situation when you have file:
|| some data ; image ; some more data ||
In this case there is no way to say where the image ends and client may
also access content in the "some more data" area. Thus corrupting the
data outside the image.
What about something like this:
Normally qemu-nbd assumes that the image spans from the beginning of
the file (or from position specified by --offset) to the end of the
file. If the image is embedded inside the file and there are some
other data after the image this may lead to reads/writes outside the
image and data corruption.
This patch adds new command line argument --size that limits the
assumed device size. This way the user can specify that the image
ends sooner than at the end of the file.
> help is --device-size, not --image-size; I would just call it --size.
Ok. I will change it to --size.