Bug 1941600 - libvirtd crashes when deleting checkpoint which was redefined with incomplete XML
Summary: libvirtd crashes when deleting checkpoint which was redefined with incomplete...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.4
Assignee: Peter Krempa
QA Contact: yisun
URL:
Whiteboard:
: 1941597 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-22 13:22 UTC by Peter Krempa
Modified: 2021-05-25 06:49 UTC (History)
6 users (show)

Fixed In Version: libvirt-7.0.0-11.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-25 06:48:26 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)

Description Peter Krempa 2021-03-22 13:22:25 UTC
Description of problem:
libvirtd crashes when deleting checkpoint which was redefined with incomplete XML

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. define a checkpoint:

# cat  chkdef.xml
<domaincheckpoint>
  <name>testchk</name>
  <creationTime>1615950082</creationTime>
  <disks>
    <disk name='vda' checkpoint='bitmap'/>
  </disks>
</domaincheckpoint>

# virsh checkpoint-create --redefine $VMNAME chkdef.xml


2. # virsh checkpoint-delete $VMNAME testchk


Actual results:
libvirtd crashes

Comment 1 Peter Krempa 2021-03-22 13:26:28 UTC
*** Bug 1941597 has been marked as a duplicate of this bug. ***

Comment 6 Peter Krempa 2021-03-23 13:36:21 UTC
Fixed upstream:

commit 8fdc37711b42cd8cd75f2903629f990c74d67ad0
Author: Peter Krempa <pkrempa>
Date:   Mon Mar 22 14:44:55 2021 +0100

    virDomainCheckpointRedefinePrep: Assign default bitmap names when domain XML is missing
    
    Previously we'd assign the default checkpoint bitmap names in
    virDomainCheckpointAlignDisks. In cases when the checkpoint is redefined
    without a domain XML virDomainCheckpointAlignDisks is not called.
    
    Add an explicit call to virDomainCheckpointDefAssignBitmapNames to
    restore functionality.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

commit 3a340872f8792f35094f0ae6df10163a9ba99f12
Author: Peter Krempa <pkrempa>
Date:   Mon Mar 22 14:43:17 2021 +0100

    qemuCheckpointDiscardBitmaps: Refuse to delete checkpoint with NULL bitmap name
    
    When a checkpoint is redefined without providing the domain XML, we
    might end up with a definition where the per-disk bitmap name is not
    set. Trying to delete such checkpoint would lead to a crash.
    
    Refuse such deletion.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1941600
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

Comment 9 yisun 2021-03-24 03:03:16 UTC
Reproduced with libvirt-7.0.0-10.module+el8.4.0+10417+37f6984d.x86_64
(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# cat ck.xml 
<domaincheckpoint>
  <name>testchk</name>
  <creationTime>1615950082</creationTime>
  <disks>
    <disk name='vda' checkpoint='bitmap'/>
  </disks>
</domaincheckpoint>


(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-create vm1 ck.xml 
Domain checkpoint testchk created from 'ck.xml'

(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-delete vm1 testchk --metadata
Domain checkpoint testchk deleted

(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-create --redefine vm1 ck.xml 
Domain checkpoint testchk created from 'ck.xml'

(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-delete vm1 testchk
error: Disconnected from qemu:///system due to end of file
error: Failed to delete checkpoint testchk
error: End of file while reading data: Input/output error



Test with libvirt-7.0.0-11.el8_rc.a1f06033ee.x86_64, result is PASS
(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# cat ck.xml 
<domaincheckpoint>
  <name>testchk</name>
  <creationTime>1615950082</creationTime>
  <disks>
    <disk name='vda' checkpoint='bitmap'/>
  </disks>
</domaincheckpoint>

(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-create vm1 ck.xml 
Domain checkpoint testchk created from 'ck.xml'
(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-delete vm1 testchk --metadata
Domain checkpoint testchk deleted

(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-create --redefine vm1 ck.xml 
Domain checkpoint testchk created from 'ck.xml'
(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-delete vm1 testchk
Domain checkpoint testchk deleted

(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh destroy vm1
Domain 'vm1' destroyed

(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# qemu-img info /var/lib/libvirt/images/jeos-27-x86_64.qcow2 
image: /var/lib/libvirt/images/jeos-27-x86_64.qcow2
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 1 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false

(.libvirt-ci-venv-ci-runtest-XptyQO) [root@dell-per740-08 bz1941600]# virsh checkpoint-list vm1
 Name   Creation Time
-----------------------

a similar test was covered in https://bugzilla.redhat.com/show_bug.cgi?id=1901830#c8

Comment 13 yisun 2021-03-29 11:30:09 UTC
Same steps as https://bugzilla.redhat.com/show_bug.cgi?id=1941600#c9
PASSED with latest build:libvirt-7.0.0-11.module+el8.4.0+10505+3a8d753f.x86_64

Comment 15 errata-xmlrpc 2021-05-25 06:48:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:2098


Note You need to log in before you can comment on or make changes to this bug.