From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnpxS-0006KW-Ss for qemu-devel@nongnu.org; Fri, 23 May 2014 09:56:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnpxM-0005tV-Rz for qemu-devel@nongnu.org; Fri, 23 May 2014 09:56:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnpxM-0005tF-HK for qemu-devel@nongnu.org; Fri, 23 May 2014 09:56:20 -0400 Message-ID: <537F5380.8090807@redhat.com> Date: Fri, 23 May 2014 07:56:16 -0600 From: Eric Blake MIME-Version: 1.0 References: <1400852489-31099-1-git-send-email-maria.k@catit.be> In-Reply-To: <1400852489-31099-1-git-send-email-maria.k@catit.be> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UqvIehLE6KMjNkrpj70BvIwuEo5b468tf" Subject: Re: [Qemu-devel] [PATCH] docs: Define refcount_bits value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Maria Kustova , qemu-devel@nongnu.org Cc: kwolf@redhat.com, Maria Kustova , stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --UqvIehLE6KMjNkrpj70BvIwuEo5b468tf Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/23/2014 07:41 AM, Maria Kustova wrote: > 96 - 99: refcount_order > Describes the width of a reference count block ent= ry (width > - in bits =3D 1 << refcount_order). For version 2 im= ages, the > - order is always assumed to be 4 (i.e. the width is= 16 bits). > + in bits: refcount_bits =3D 1 << refcount_order). F= or version 2 > + images, the order is always assumed to be 4 > + (i.e. refcount_bits =3D 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 =3D (cluster_size / sizeof(uint16_t)) which implies a hard cap of refcount_bits=3D16 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 =3D 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). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --UqvIehLE6KMjNkrpj70BvIwuEo5b468tf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTf1OAAAoJEKeha0olJ0NqCBgH/0l1izqhuCzcYE+JENCtrMqS Ab8UJsLlREGE2LDf0iNX000wlHL9gikSlqMKd2RWDG/Kw2WAW7HhCKkBlWrb6U18 UcofhHC3c6k0EW8/ZSfjehJXIWdPb9T3VlMy8Bdxx2V1bsD8wH+AitqzHZ3awfV6 H0R/cUTt/m9np5u3YhmARWTdDw5d/Iezxl0evqs+v0l2dMHv4+mQgkgpkF3RqPNa tFlOYUQl7GhbExRHmYUYst7OIoVcQMjD6+pFEiIyAHQ2yL5J2395c7SOK57A5uLs 28zG7KTD8o6AoxAmV8ALrUZ7n1y0r5Ih7/t83Ms6R/zMWvFBTVasYPzOESDWiQY= =Pdgl -----END PGP SIGNATURE----- --UqvIehLE6KMjNkrpj70BvIwuEo5b468tf--