Bug 1300532 - Libvirtd crashes when start guests if setting guest disk image source file pointing to a non-existing path and unix channel souce mode=connect
Summary: Libvirtd crashes when start guests if setting guest disk image source file po...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Martin Kletzander
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-21 04:48 UTC by Fangge Jin
Modified: 2016-02-03 10:14 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-02-03 10:14:42 UTC
Embargoed:


Attachments (Terms of Use)
libvirtd log and guest XML (106.20 KB, application/x-gzip)
2016-01-21 04:48 UTC, Fangge Jin
no flags Details
backtrace (14.64 KB, text/plain)
2016-01-21 05:36 UTC, Fangge Jin
no flags Details

Description Fangge Jin 2016-01-21 04:48:14 UTC
Created attachment 1116780 [details]
libvirtd log and guest XML

Description of problem:
Set unix channel mode to "connect" and disk image source file pointing to a non-existing path in guest XML, then start guest, libvirtd will crash.


Version-Release number of selected component (if applicable):
libvirt:
# git describe
v1.3.1-11-g020135d

qemu:
# git describe
v2.5.0-640-g3db34bf



How reproducible:
100%

Steps to Reproduce:
1.Prepare guest XML as below:
# virsh dumpxml rhel7.2-1
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/90121/fjin/r7raw.raw'/>

...
    <channel type='unix'>
      <source mode='connect'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
...

# ls /90121/fjin/r7raw.raw
ls: cannot access /90121/fjin/r7raw.raw: No such file or directory

2. Start guest, libvirtd crashes:
# virsh start rhel7.2-1
error: Disconnected from qemu:///system due to I/O error
error: Failed to start domain rhel7.2-1
error: End of file while reading data: Input/output error

error: One or more references were leaked after disconnect from the hypervisor

3.Set unix channel source mode to bind, libvirtd doesn't crash:
# virsh dumpxml rhel7.2-1
...
    <channel type='unix'>
      <source mode='bind'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
...

# virsh start rhel7.2-1
error: Failed to start domain rhel7.2-1
error: Cannot access storage file '/90121/fjin/r7raw.raw' (as uid:107, gid:107): No such file or directory



Actual results:
Libvirtd crashes.

Expected results:
Libvirtd doesn't crash.

Additional info:
1. I test with libvirt-1.2.17-13.el7_2.2.x86_64, set guest xml as below, libvirtd doesn't crash:
# virsh dumpxml rhel7.2
...
    <channel type='unix'>
      <source mode='connect' path='/var/lib/libvirt/qemu/channel/target/domain-rhel7.2/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
...

# virsh start rhel7.2
error: Failed to start domain rhel7.2
error: Cannot access storage file '/var/lib/libvirt/images/rraw.raw' (as uid:107, gid:107): No such file or directory

Comment 1 Fangge Jin 2016-01-21 05:36:26 UTC
Created attachment 1116781 [details]
backtrace

Comment 2 Martin Kletzander 2016-02-03 10:14:42 UTC
Fixed upstream by v1.3.1-96-g1794a0103ae4:

commit 1794a0103ae4fa91d9c11617e7981471173e27ce
Author: Martin Kletzander <mkletzan>
Date:   Tue Feb 2 22:08:59 2016 +0100

    qemu: Don't crash when create fails early


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