Bug 880919

Summary: Libvirtd crashed while saving the guest to a nonexistent directory
Product: Red Hat Enterprise Linux 6 Reporter: zhenfeng wang <zhwang>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.4CC: acathrow, bili, dyasny, dyuan, eblake, gsun, jtomko, linuxdev-kernel-it, mzhan, rwu
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-11.el6 Doc Type: Bug Fix
Doc Text:
Cause: virFileWrapperFdCatchError was called with a NULL argument when the save file could not be opened. Consequence: Libvirtd would crash due to NULL pointer dereference. Fix: Only call virFileWrapperFdCatchError if the file was opened. Result: An error is reported instead of crashing.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:27:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 785929, 886216    

Description zhenfeng wang 2012-11-28 07:30:46 UTC
Description of problem:
Libvirtd crashed while save the guest to an unexsited directory
Version-Release number of selected component (if applicable):
libvirt-0.10.2-10.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.335.el6.x86_64
kernel-2.6.32-330.el6.x86_6

How reproducible:
100%
1 Prepare a running guest
# virsh list
 Id    Name                           State
----------------------------------------------------
 1     rhelqcow2                      running

2 Save the guest to an unexsited derectory
# virsh save rhelqcow2 /unexsited/rhel.save
error: Failed to save domain rhelqcow2 to /unexsited/rhel.save
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

Actual results:
The libvirtd crashed

Expected results:
The guest will fail to save, however, the libvirtd should still run normally.

Comment 2 zhenfeng wang 2012-11-28 08:01:45 UTC
Since it works well in pkg libvirt-0.9.10-21.el6.x86_64 ,so mark it as a regression bug 

in pkg libvirt-0.9.10-21.el6.x86_64
# virsh save rhelqcow2 /unexsited/rhel.save
error: Failed to save domain testfull to /unexsited/rhel.save
error: Failed to create file '/unexsited/rhel.save': Operation not permitted

Comment 4 Ján Tomko 2012-11-28 08:15:10 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2012-November/msg01241.html

Comment 5 Ján Tomko 2012-11-28 09:42:53 UTC
Fixed upstream:
commit 8927c0eab6681ee4ae014cb37fe60b42c225b8df
Author:     Ján Tomko <jtomko>
AuthorDate: 2012-11-28 09:08:52 +0100
Commit:     Martin Kletzander <mkletzan>
CommitDate: 2012-11-28 10:24:31 +0100

    qemu: fix a crash when save file can't be opened

Posted downstream:
http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-November/msg00306.html

Comment 7 EricLee 2012-12-07 05:22:26 UTC
Verified with libvirt-0.10.2-11.el6.x86_64:

# virsh start r6u3
Domain r6u3 started

# virsh save r6u3 /unexsited/r6u3.save
error: Failed to save domain r6u3 to /unexsited/r6u3.save
error: Failed to create file '/unexsited/r6u3.save': Operation not permitted

And libvirtd does not crash:
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     r6u3                           running

# service libvirtd status
libvirtd (pid  11853) is running...

Get the expected result, so moving to VERIFIED.

Comment 8 Peter Krempa 2013-01-10 10:26:17 UTC
*** Bug 893814 has been marked as a duplicate of this bug. ***

Comment 9 errata-xmlrpc 2013-02-21 07:27:49 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