From: Eric Blake <eblake@redhat.com>
To: Roman Kagan <rkagan@virtuozzo.com>, Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org
Cc: Denis Lunev <den@openvz.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH for-2.5] qcow2: always initialize specific image info
Date: Mon, 7 Dec 2015 10:51:46 -0700 [thread overview]
Message-ID: <5665C732.4010107@redhat.com> (raw)
In-Reply-To: <1449508029-14664-1-git-send-email-rkagan@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 1922 bytes --]
[adding qemu-devel - ALL patches should go to qemu-devel, even if they
are also going to a sub-list like qemu-block]
On 12/07/2015 10:07 AM, Roman Kagan wrote:
> qcow2_get_specific_info() used to have a code path which would leave
> pointer to ImageInfoSpecificQCow2 uninitialized.
>
> We guess that it caused sporadic crashes on freeing an invalid pointer
> in response to "query-block" QMP command in
> visit_type_ImageInfoSpecificQCow2 with QapiDeallocVisitor.
>
> Although we have neither a solid proof nor a reproduction scenario,
> making sure the field is initialized appears a reasonable thing to do.
>
> Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
> ---
> block/qcow2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 88f56c8..67c9d3d 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2739,7 +2739,7 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)
>
> *spec_info = (ImageInfoSpecific){
> .type = IMAGE_INFO_SPECIFIC_KIND_QCOW2,
> - .u.qcow2 = g_new(ImageInfoSpecificQCow2, 1),
> + .u.qcow2 = g_new0(ImageInfoSpecificQCow2, 1),
NACK. This makes no difference, except when s->qcow_version is out of spec.
> };
> if (s->qcow_version == 2) {
> *spec_info->u.qcow2 = (ImageInfoSpecificQCow2){
>
If s->qcow_version is exactly 2, then we end up initializing all fields
due to the assignment here; same if qcow_version is exactly 3. The only
time qcow2 remains uninitialized is if qcow_version is 0, 1, or > 3; but
we refuse to handle qcow files with out-of-range versions. So I don't
see how you are plugging any uninitialized values; and therefore, I
don't see how this is patching any crashes.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next parent reply other threads:[~2015-12-07 17:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1449508029-14664-1-git-send-email-rkagan@virtuozzo.com>
2015-12-07 17:51 ` Eric Blake [this message]
2015-12-07 17:54 ` [Qemu-devel] [Qemu-block] [PATCH for-2.5?] qcow2: always initialize specific image info Eric Blake
2015-12-07 18:11 ` Denis V. Lunev
2015-12-07 19:44 ` Max Reitz
2015-12-08 9:37 ` Kevin Wolf
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=5665C732.4010107@redhat.com \
--to=eblake@redhat.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rkagan@virtuozzo.com \
/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).