From: Stefan Hajnoczi <stefanha@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, Maria Kustova <maxa@catit.be>,
qemu-devel@nongnu.org, Maria Kustova <maria.k@catit.be>
Subject: Re: [Qemu-devel] [PATCH] docs: Define refcount_bits value
Date: Fri, 23 May 2014 17:20:54 +0200 [thread overview]
Message-ID: <20140523152054.GB4585@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <537F5380.8090807@redhat.com>
On Fri, May 23, 2014 at 07:56:16AM -0600, Eric Blake wrote:
> On 05/23/2014 07:41 AM, Maria Kustova wrote:
>
> > 96 - 99: refcount_order
> > Describes the width of a reference count block entry (width
> > - in bits = 1 << refcount_order). For version 2 images, the
> > - order is always assumed to be 4 (i.e. the width is 16 bits).
> > + in bits: refcount_bits = 1 << refcount_order). For version 2
> > + images, the order is always assumed to be 4
> > + (i.e. refcount_bits = 16).
>
> In light of all the recent CVE fixes (and possibly a separate patch if
> any code is broken), I wonder if we need more work to ensure that
> refcount_order is capped to a worthwhile maximum rather than causing
> undefined behavior. That is, a refcount_order of 0x10004 should be an
> error, and not a synonym of refcount_order of 4, since '1 << 0x10004' is
> undefined.
>
> Furthermore, this raises some questions in my mind. Later on, we document:
>
> refcount_block_entries = (cluster_size / sizeof(uint16_t))
>
> which implies a hard cap of refcount_bits=16 as the maximum, which in
> turn implies a hard cap of refcount_order of 4 as the maximum. Or is it
> possible to specify a larger refcount_order, in which case
> refcount_block_entries is dynamically sized to uint32_t, and in which
> case the rest of the docs need to be fixed to accommodate that?
>
> Also,
>
> Refcount block entry (x = refcount_bits - 1):
>
> Bit 0 - x: Reference count of the cluster. If refcount_bits
> implies a
> sub-byte width, note that bit 0 means the least
> significant
> bit in this context.
>
> but nothing is said about bits x+1 - 15 (which only exist when
> refcount_order < 4, but which presumably must be all 0 bits for the file
> to be valid).
Only refcount_order = 4 is supported by QEMU at the moment.
I agree the spec could be made a bit clearer though. Maybe Kevin wants
to send a patch to explain the details of refcount entry sizing.
Stefan
next prev parent reply other threads:[~2014-05-23 15:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-23 13:41 [Qemu-devel] [PATCH] docs: Define refcount_bits value Maria Kustova
2014-05-23 13:45 ` Eric Blake
2014-05-23 13:56 ` Eric Blake
2014-05-23 15:20 ` Stefan Hajnoczi [this message]
2014-05-23 15:21 ` 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=20140523152054.GB4585@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=maria.k@catit.be \
--cc=maxa@catit.be \
--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).