Bug 1258361 - Libvirtd crash when attach-disk with an unsupported disk address ccw
Libvirtd crash when attach-disk with an unsupported disk address ccw
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
x86_64 Unspecified
high Severity high
: rc
: ---
Assigned To: John Ferlan
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-31 03:54 EDT by Pei Zhang
Modified: 2015-11-19 01:52 EST (History)
6 users (show)

See Also:
Fixed In Version: libvirt-1.2.17-8.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 01:52:50 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Pei Zhang 2015-08-31 03:54:23 EDT
Description of problem:
Although we don't support s903 machine / vm, but virsh commands have some options related to it (like ccw type address). So libvirtd should also run well even though we do some invalid operations.

Version-Release number of selected component (if applicable):
libvirt-1.2.17-6.el7.x86_64
qemu-kvm-rhev-2.3.0-18.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1. check current libvirtd pid

# ps -ef|grep libvirtd
root      1033     1  0 15:21 ?        00:00:00 /usr/sbin/libvirtd

# virsh list 
 Id    Name                           State
----------------------------------------------------
 51    r72                            running

2. attach disk with address is ccw

# virsh attach-disk r72 /var/lib/libvirt/images/raw.img vde --targetbus virtio --address ccw:00.0.0000
error: Failed to attach disk
error: End of file while reading data: Input/output error

3. check libvirtd pid ; libvirtd was restart

# ps -ef| grep libvirtd
root      3973     1  0 15:31 ?        00:00:00 /usr/sbin/libvirtd

4.cold plug disk with ccw address
# virsh attach-disk r72 /var/lib/libvirt/images/raw.img vde --targetbus virtio --address ccw:00.0.0000 --config
Disk attached successfully

5. start guest 
# virsh start r72
error: Failed to start domain r72
error: internal error: process exited while connecting to monitor: 
2015-08-31T02:47:31.816904Z qemu-kvm: -device virtio-blk-ccw,scsi=off,devno=0.0.0000,drive=drive-virtio-disk4,id=virtio-disk4: 'virtio-blk-ccw' is not a valid device model name

Actual results:
As step2 and step3 , fail to attach disk , but libvirtd crash.

Expected results:
Libvirtd won't crash. and as step5, give clear error message .  

Additional info:
core_backtrace form abrt:

{   "signal": 11
,   "executable": "/usr/sbin/libvirtd"
,   "stacktrace":
      [ {   "crash_thread": true
        ,   "frames":
              [ {   "address": 139723471082910
                ,   "build_id": "d323059eae8c8710c5cff4ff546adbf8c039c1df"
                ,   "build_id_offset": 869790
                ,   "function_name": "virDomainCCWAddressAssign"
                ,   "file_name": "/lib64/libvirt.so.0"
                }
              , {   "address": 139722876216111
                ,   "build_id": "5c69fcd6eb2eb9911d99eba147eee27d3c74bda7"
                ,   "build_id_offset": 455471
                ,   "function_name": "qemuDomainAttachDeviceDiskLive"
                ,   "file_name": "/usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so"
                }
              , {   "address": 139722876669448
                ,   "build_id": "5c69fcd6eb2eb9911d99eba147eee27d3c74bda7"
                ,   "build_id_offset": 908808
                ,   "function_name": "qemuDomainAttachDeviceFlags"
                ,   "file_name": "/usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so"
                }
              , {   "address": 139723471698566
                ,   "build_id": "d323059eae8c8710c5cff4ff546adbf8c039c1df"
                ,   "build_id_offset": 1485446
                ,   "function_name": "virDomainAttachDevice"
                ,   "file_name": "/lib64/libvirt.so.0"
                }
              , {   "address": 139723484587055
                ,   "build_id": "a9d9a89b2c451d612aaf24c48c85c1bae3488a88"
                ,   "build_id_offset": 250927
                ,   "function_name": "remoteDispatchDomainAttachDeviceHelper"
                ,   "file_name": "/usr/sbin/libvirtd"
                }
              , {   "address": 139723472102962
                ,   "build_id": "d323059eae8c8710c5cff4ff546adbf8c039c1df"
                ,   "build_id_offset": 1889842
                ,   "function_name": "virNetServerProgramDispatch"
                ,   "file_name": "/lib64/libvirt.so.0"
                }
              , {   "address": 139723472083117
                ,   "build_id": "d323059eae8c8710c5cff4ff546adbf8c039c1df"
                ,   "build_id_offset": 1869997
                ,   "function_name": "virNetServerHandleJob"
                ,   "file_name": "/lib64/libvirt.so.0"
                }
Comment 1 Pei Zhang 2015-08-31 05:47:08 EDT
> Description of problem:
> Although we don't support s903 machine .

Sorry, wrote the wrong machine type. changed it.
s/s903/s390
Comment 2 John Ferlan 2015-08-31 12:47:29 EDT
Just for completeness, the following XML added to domain would cause the same failure for the config option:

  <disk type='file' device='disk'>
    <driver name='qemu' type='raw'/>
    <source file='/home/vm-images/test-1g.img'/>
    <target dev='vde' bus='virtio'/>
    <address type='ccw' cssid='0x0' ssid='0x0' devno='0x0000'/>
  </disk>


BTW: A similar problem exists for the <rng>
Comment 3 John Ferlan 2015-08-31 13:09:13 EDT
see upstream patch:

http://www.redhat.com/archives/libvir-list/2015-August/msg01043.html
Comment 4 John Ferlan 2015-09-03 17:02:09 EDT
Posted a v2:

http://www.redhat.com/archives/libvir-list/2015-September/msg00109.html

Review points out that hotplug of scsi controller results in same crash, e.g.

$ cat ctlr-ccw.xml
<controller type='scsi' index='10'>
   <address type='ccw' cssid='0x0' ssid='0x0' devno='0x0000'/>
</controller>
$ virsh attach-device $dom ctlr-ccw.xml

Similarly for rng:

$ cat rng-ccw.xml
<rng model='virtio'>
   <backend model='random'>/dev/hwrng</backend>
   <address type='ccw' cssid='0x0' ssid='0x0' devno='0x0000'/>
</rng>
$ virsh attach-device $dom rng-ccw.xml

With v2 of the patch applied, errors would be:

error: unsupported configuration: cannot use CCW address type for device 'vde' using machine type 'pc-i440fx-1.4'

or

error: unsupported configuration: cannot use CCW address type for device '/dev/hwrng' using machine type 'pc-i440fx-1.4'

or

error: unsupported configuration: cannot use CCW address type for device 'controller' using machine type 'pc-i440fx-1.4'
Comment 5 John Ferlan 2015-09-03 17:03:04 EDT
Setting exception flag because we're late in the release and this does cause a libvirtd crash
Comment 8 yisun 2015-09-09 04:56:49 EDT
Verified on:
libvirt-1.2.17-8.el7.x86_64
qemu-kvm-rhev-2.3.0-22.el7.x86_64
kernel-3.10.0-314.el7.x86_64

1. use attack-disk to test
[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155     1  1 16:41 ?        00:00:00 /usr/sbin/libvirtd


[root@lento80 ~]# virsh attach-disk rhel7_Sep4 /var/lib/libvirt/images/test.raw vde --targetbus virtio --address ccw:00.0.0000
error: Failed to attach disk
error: unsupported configuration: cannot use CCW address type for device 'vde' using machine type 'pc-i440fx-rhel7.2.0'

[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155<=== not crashed     1  0 16:41 ?        00:00:00 /usr/sbin/libvirtd

[root@lento80 ~]# virsh attach-disk rhel7_Sep4 /var/lib/libvirt/images/test.raw vde --targetbus virtio --address ccw:00.0.0000 --config
Disk attached successfully

[root@lento80 ~]# virsh destroy rhel7_Sep4
Domain rhel7_Sep4 destroyed

[root@lento80 ~]# virsh start rhel7_Sep4
error: Failed to start domain rhel7_Sep4
error: unsupported configuration: cannot use CCW address type for device 'vde' using machine type 'pc-i440fx-rhel7.2.0'

[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155<=== not crashed     1  0 16:41 ?        00:00:00 /usr/sbin/libvirtd


2. use attack-device to test
[root@lento80 ~]# virsh edit rhel7_Sep4
Domain rhel7_Sep4 XML configuration edited.

[root@lento80 ~]# cat disk.xml 
  <disk type='file' device='disk'>
    <driver name='qemu' type='raw'/>
    <source file='/var/lib/libvirt/images/test.raw'/>
    <target dev='vde' bus='virtio'/>
    <address type='ccw' cssid='0x0' ssid='0x0' devno='0x0000'/>
  </disk>
[root@lento80 ~]# virsh attach-device rhel7_Sep4 disk.xml 
error: Failed to attach device from disk.xml
error: Requested operation is not valid: cannot do live update a device on inactive domain

[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155<=== not crashed     1  0 16:41 ?        00:00:00 /usr/sbin/libvirtd

# virsh attach-device rhel7_Sep4 disk.xml --config
Device attached successfully

[root@lento80 ~]# virsh destroy rhel7_Sep4;virsh start rhel7_Sep4
error: Failed to destroy domain rhel7_Sep4
error: Requested operation is not valid: domain is not running

error: Failed to start domain rhel7_Sep4
error: unsupported configuration: cannot use CCW address type for device 'vde' using machine type 'pc-i440fx-rhel7.2.0'

[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155<=== not crashed     1  0 16:41 ?        00:00:00 /usr/sbin/libvirtd


3. test controller hot-plug
[root@lento80 ~]# cat controller.xml 
<controller type='scsi' index='10'>
   <address type='ccw' cssid='0x0' ssid='0x0' devno='0x0000'/>
</controller>

[root@lento80 ~]# virsh attach-device rhel7_Sep4 controller.xml 
error: Failed to attach device from controller.xml
error: unsupported configuration: cannot use CCW address type for device 'controller' using machine type 'pc-i440fx-rhel7.2.0'

[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155<=== not crashed     1  0 16:41 ?        00:00:00 /usr/sbin/libvirtd

[root@lento80 ~]# virsh attach-device rhel7_Sep4 controller.xml --config
Device attached successfully

[root@lento80 ~]# virsh destroy rhel7_Sep4;virsh start rhel7_Sep4
Domain rhel7_Sep4 destroyed

error: Failed to start domain rhel7_Sep4
error: unsupported configuration: cannot use CCW address type for device 'controller' using machine type 'pc-i440fx-rhel7.2.0'

[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155<=== not crashed     1  0 16:41 ?        00:00:00 /usr/sbin/libvirtd

4. test rng hot-plug

[root@lento80 ~]# cat rng.xml 
<rng model='virtio'>
   <backend model='random'>/dev/hwrng</backend>
   <address type='ccw' cssid='0x0' ssid='0x0' devno='0x0000'/>
</rng>
[root@lento80 ~]# virsh attach-device rhel7_Sep4 rng.xml 
error: Failed to attach device from rng.xml
error: unsupported configuration: cannot use CCW address type for device '/dev/hwrng' using machine type 'pc-i440fx-rhel7.2.0'

[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155<=== not crashed     1  0 16:41 ?        00:00:00 /usr/sbin/libvirtd
[root@lento80 ~]# virsh attach-device rhel7_Sep4 rng.xml --config
Device attached successfully

[root@lento80 ~]# virsh destroy rhel7_Sep4;virsh start rhel7_Sep4
Domain rhel7_Sep4 destroyed

error: Failed to start domain rhel7_Sep4
error: unsupported configuration: cannot use CCW address type for device '/dev/hwrng' using machine type 'pc-i440fx-rhel7.2.0'

[root@lento80 ~]# ps -ef |  grep -v grep | grep libvirtd
root     28155<=== not crashed     1  0 16:41 ?        00:00:00 /usr/sbin/libvirtd
Comment 10 errata-xmlrpc 2015-11-19 01:52:50 EST
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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html

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