Bug 1138125

Summary: forbid invalid address type for panic device
Product: Red Hat Enterprise Linux 7 Reporter: Jincheng Miao <jmiao>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, libvirt-maint, mzhan, rbalakri, virt-bugs, zhwang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1138122 Environment:
Last Closed: 2015-11-19 05:48:14 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: 1138122    
Bug Blocks:    

Description Jincheng Miao 2014-09-04 06:34:37 UTC
+++ This bug was initially created as a clone of Bug #1138122 +++

Description of problem:
panic device only could specify isa type address with iobase(ioport).
libvirt should forbid other address type for panic device in order to avoid confusion from users.


Version-Release number of selected component (if applicable):
libvirt-1.2.8-1.el7.x86_64
qemu-kvm-rhev-2.1.0-3.el7.x86_64 


How reproducible:
100%

Steps to Reproduce:
1. add panic device to guest, which address is same with memballoon
# virsh edit r7a
...
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
    <panic>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </panic>
...

2. start it
# virsh start r7a
Domain r7a started

# ps -ef | grep qemu
qemu     10526     1 58 14:33 ?        00:00:09 /usr/libexec/qemu-kvm -name r7a -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid c4fa19e8-e8c9-49ab-b6bf-0427ed4e750e -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/r7a.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/var/lib/libvirt/images/r7a.img,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=23,id=hostnet0,vhost=on,vhostfd=24 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:06:af:9a,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -device usb-tablet,id=input0 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -device pvpanic -msg timestamp=on

Expect result:
in step 1, report an error.

Comment 1 Erik Skultety 2014-09-08 12:19:02 UTC
Fixed upstream:

commit afb4c6b6634e16beb5ddbca3f1113c615e10e7e4
Author: Erik Skultety <eskultet>
Date:   Mon Sep 8 12:27:23 2014 +0200

    qemu: panic device: check for invalid address type
    
    qemu now checks for invalid address type for a panic device, which is
    currently implemented only to use ISA address type, thus rejecting
    any other options, except for leaving XML attributes blank, in that case,
    defaults are used (this behaviour remains the same from earlier verions).
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1138125
    
    Signed-off-by: Martin Kletzander <mkletzan>

v1.2.8-53-gafb4c6b

Comment 3 zhenfeng wang 2015-05-22 10:36:22 UTC
I can reproduce this issue with libvirt-1.2.8-16.el7.x86_64.rpm, verify this bug with libvirt-1.2.15-2.el7.x86_64, the verify steps as following

steps

1. add panic device to guest, which address is same with memballoon,will fail to save the guest
# virsh edit 7.0
...
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
    <panic>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </panic>
...
:wq
error: XML error: Attempted double use of PCI slot 0000:00:07.0 (may need "multifunction='on'" for device on function 0)
Failed. Try again? [y,n,i,f,?]: 


2.Add panic device to guest which have different pci address with other device in guest's xml, start the guest, will get an expect error
#virsh dumpxml 7.0
--
    <panic>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </panic>

# virsh start 7.0
error: Failed to start domain 7.0
error: unsupported configuration: panic is supported only with ISA address type

3.Add panic device to guest with virtio-serial address, start the guest, will get the expect error
#virsh dumpxml 7.0
--
    <panic>
      <address type='virtio-serial' controller='0' bus='0' port='3'/>
    </panic>

# virsh start 7.0
error: Failed to start domain 7.0
error: unsupported configuration: panic is supported only with ISA address type

4.Start a guest with pure panic device, the guest could start successfully, also the panic function works well
#virsh dumpxml 7.0
--
<panic/>

# virsh start 7.0
Domain 7.0 started

#ps aux|grep qemu
--
-device pvpanic -msg timestamp=on

5.Start a guest with panic device with ISA address type, also panic function works well
#virsh dumpxml 7.0
--
    <panic>
      <address type='isa' iobase='0x505'/>
    </panic>

# virsh start 7.0
Domain 7.0 started

According to the upper steps, mark this bug verified

Comment 6 errata-xmlrpc 2015-11-19 05:48:14 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.

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