qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: John Snow <jsnow@redhat.com>,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-block@nongnu.org
Cc: kwolf@redhat.com, libvirt-list@redhat.com,
	Peter Krempa <pkrempa@redhat.com>,
	qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [PATCH for-4.2?] block/qcow2-bitmap: fix crash bug in qcow2_co_remove_persistent_dirty_bitmap
Date: Thu, 5 Dec 2019 15:53:45 -0600	[thread overview]
Message-ID: <9fa95d95-f17f-d529-a0df-6d6197192785@redhat.com> (raw)
In-Reply-To: <990da2e0-8223-b257-254d-a27659ef1d24@redhat.com>

On 12/5/19 2:16 PM, John Snow wrote:

>>> Last minute edit: hmm, actually, transaction action introduced in
>>> 4.2, so crash is not a regression, only broken block-dirty-bitmap-remove
>>> command is a regression... Maybe it's OK for stable.
>>
>> Libvirt REALLY wants to use transaction bitmap management (and require
>> qemu 4.2) for its incremental backup patches that Peter is almost ready
>> to merge in.  I'm trying to ascertain:
>>
>> When exactly can this bug hit?  Can you give a sequence of QMP commands
>> that will trigger it for easy reproduction?  Are there workarounds (such
>> as checking that a bitmap exists prior to attempting to remove it)?  If
>> it does NOT get fixed in rc5, how will libvirt be able to probe whether
>> the fix is in place?
>>
> 
> It looks like:
> 
> - You need to have at least one bitmap
> - You need to use transactional remove
> - you need to misspell the bitmap name
> - The remove will fail (return -EINVAL) but doesn't set errp
> - The caller chokes on incomplete information, state->bitmap is NULL

So in libvirt's case, as long as libvirt manages bitmaps completely, 
it's a bug in libvirt to request deletion of a bitmap that doesn't 
exist.  Or, someone messes with a qcow2 image of an offline guest behind 
libvirt's back without updating libvirt's metadata of what bitmaps 
should exist, and then if libvirt fails to check that a bitmap actually 
exists, a user may be able to coerce libvirt into requesting a bitmap 
deletion that will cause a qemu crash, but that's the user's fault for 
going behind libvirt's back.  Or, libvirt could add code that instead of 
trying to blindly delete a bitmap, it first makes a QMP call to ensure 
the bitmap still exists (annoying, but harmless even when the bug is 
fixed), instead of blaming the bug on the user operating behind 
libvirt's back.

The bug is nasty, but feels to be enough of a corner case that I think 
deferring to 5.0 with CC: stable (and then downstreams can backport it 
at will) is the right approach; no need to hold up 4.2 if this is the 
only flaw.  But I'm also not opposed to it going in 4.2 if we have 
anything else serious.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2019-12-05 21:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05 19:30 [PATCH for-4.2?] block/qcow2-bitmap: fix crash bug in qcow2_co_remove_persistent_dirty_bitmap Vladimir Sementsov-Ogievskiy
2019-12-05 19:39 ` John Snow
2019-12-05 20:09 ` Eric Blake
2019-12-05 20:16   ` John Snow
2019-12-05 21:53     ` Eric Blake [this message]
2019-12-05 22:00       ` John Snow
2019-12-06 10:18     ` Vladimir Sementsov-Ogievskiy
2019-12-06 14:36       ` Eric Blake
2019-12-06 19:02         ` John Snow
2019-12-06 19:48           ` Eric Blake
2019-12-06 14:29   ` Vladimir Sementsov-Ogievskiy

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=9fa95d95-f17f-d529-a0df-6d6197192785@redhat.com \
    --to=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=libvirt-list@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@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).