RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 896403 - delete snapshot which name contain '/' lead to libvirtd crash
Summary: delete snapshot which name contain '/' lead to libvirtd crash
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 905536
TreeView+ depends on / blocked
 
Reported: 2013-01-17 08:34 UTC by yanbing du
Modified: 2013-02-21 07:29 UTC (History)
10 users (show)

Fixed In Version: libvirt-0.10.2-17.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 07:29:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
libvirtd-crash.log (64.42 KB, text/plain)
2013-01-17 08:34 UTC, yanbing du
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 21:18:26 UTC

Description yanbing du 2013-01-17 08:34:16 UTC
Created attachment 680077 [details]
libvirtd-crash.log

Description of problem:
Create an internal snapshot which name contain '/', then delete it via virsh snapshot-delete command. This will lead to libvitd crash.

In fact, when create the snapshot, the snapshot xml doesn't create:
2013-01-17 08:09:26.925+0000: 24012: error : virFileRewrite:501 : cannot create file '/var/lib/libvirt/qemu/snapshot/test//tmp/test.sn.xml.new': No such file or directory
2013-01-17 08:09:26.925+0000: 24012: warning : qemuDomainSnapshotCreateXML:11790 : unable to save metadata for snapshot /tmp/test.sn

Version-Release number of selected component (if applicable):
libvirt-0.10.2-15.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.351.el6.x86_64
kernel-2.6.32-353.el6.x86_64 

How reproducible:
100% 

Steps to Reproduce:
1. Create an internal snapshot for a domain
# virsh snapshot-create-as test /tmp/test.sn
Domain snapshot /tmp/test.sn created

# virsh snapshot-list test
 Name                 Creation Time             State
------------------------------------------------------------
 /tmp/test.sn         2013-01-17 16:00:57 +0800 shutoff

# ls /var/lib/libvirt/qemu/snapshot/test//tmp/test.sn
ls: cannot access /var/lib/libvirt/qemu/snapshot/test//tmp/test.sn: No such file or directory

2. Delete the new created snapshot
# virsh snapshot-delete test /tmp/test.sn
error: Failed to delete snapshot /tmp/test.sn
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

3. Restart libvirtd and check the snapshot
#  virsh snapshot-list test
 Name                 Creation Time             State
------------------------------------------------------------
# qemu-img info /tmp/as2
image: /tmp/as2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 160K
cluster_size: 65536
backing file: /tmp/asd
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
3         /tmp/test.sn              0 2013-01-17 16:00:57   00:00:00.000

  
Actual results:
libvirtd crash 

Expected results:
libvirtd still running.
Or, when create snapshot, libvirt can refuse the snapshot name which contain '/'.

Additional info:
BTW, on libvirt-0.9.10-21.el6_3.8.x86_64, libvirtd will not crash. So this should be a regression bug.

Comment 3 Peter Krempa 2013-01-17 13:13:22 UTC
Patches for the issue posted upstream:
http://www.redhat.com/archives/libvir-list/2013-January/msg01220.html

Comment 4 Peter Krempa 2013-01-21 11:04:48 UTC
Fixed upstream:

commit 790f912b468657859466215312dbfb0b1a9a1f69
Author: Peter Krempa <pkrempa>
Date:   Thu Jan 17 14:07:10 2013 +0100

    qemu: Reject attempts to create snapshots with names containig '/'
    
    The snapshot name is used to create path to the definition save file.
    When the name contains slashes the creation of the file fails. Reject
    such names.

commit 27054e1217e2787b1806f55c5f6eb8908612d690
Author: Peter Krempa <pkrempa>
Date:   Thu Jan 17 14:04:01 2013 +0100

    qemu: Don't return success if creation of snapshot save file fails
    
    When the snapshot definition can't be saved, the
    qemuDomainSnapshotCreate function succeeded without filling some of the
    fields in the internal definition.
    
    This patch removes the snapshot and returns failure if the XML file
    cannot be written.

Comment 7 yanbing du 2013-01-24 05:08:16 UTC
Test with libvirt-0.10.2-17.el6.x86_64

# virsh snapshot-create-as test /tmp/test.sn
error: invalid snapshot name '/tmp/test.sn': name can't contain '/'

So, move but to VERIFIED.

Comment 8 errata-xmlrpc 2013-02-21 07:29:55 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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHSA-2013-0276.html


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