Bug 879473 - net-update may cause libvirtd crash when modify portgroup
Summary: net-update may cause libvirtd crash when modify portgroup
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.4
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 886216
TreeView+ depends on / blocked
 
Reported: 2012-11-23 05:54 UTC by weizhang
Modified: 2013-02-21 07:27 UTC (History)
7 users (show)

Fixed In Version: libvirt-0.10.2-11.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 07:27:38 UTC
Target Upstream Version:


Attachments (Terms of Use)
libvirtd crash log (64.12 KB, text/plain)
2012-11-23 05:54 UTC, weizhang
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 weizhang 2012-11-23 05:54:02 UTC
Created attachment 650212 [details]
libvirtd crash log

Description of problem:
net-update may cause libvirtd crash when modify portgroup with xml "<portgroup default='xxx'/>"


Version-Release number of selected component (if applicable):
libvirt-0.10.2-9.el6.x86_64
qemu-kvm-0.12.1.2-2.323.el6.x86_64
kernel-2.6.32-329.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Define a network with "<portgroup name='engineering'>", for example
<network>
  <name>testnet</name>
  <uuid>50dc2e11-2cd7-06e4-8b04-80d9c6649623</uuid>
  <forward mode='route'/>
  <bridge name='testbridge' stp='on' delay='0' />
  <mac address='52:54:00:83:20:D7'/>
  <ip address='192.168.111.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.111.2' end='192.168.111.254' />
    </dhcp>
  </ip>
  <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64'>
  </ip>
  <portgroup name='engineering'>
  </portgroup>
</network>


# virsh net-update testnet modify portgroup "<portgroup default='no'/>"
  
Actual results:
error: Failed to update network testnet
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

libvirtd status is "libvirtd dead but pid file exists"


Expected results:
no crash occured

Additional info:
The crash log is in the attachment

Comment 1 Laine Stump 2012-11-26 20:45:02 UTC
A quick look indicates we may not be checking for the mandatory "name" attribute in the parse function for portgroup. That's likely the culprit.

Comment 2 Laine Stump 2012-11-28 17:56:32 UTC
Fix pushed upstream. Will be in upstream libvirt-1.0.1

commit 012d69dff1e031f8079a9952e886a31795e589b2
Author: Laine Stump <laine@laine.org>
Date:   Tue Nov 27 23:59:17 2012 -0500

    network: fix crash when portgroup has no name
    
    The name attribute is required for portgroup elements (yes, the RNG
    specifies that), and there is code in libvirt that assumes it is
    non-null.  Unfortunately, the portgroup parsing function wasn't
    checking for lack of portgroup. One adverse result of this was that
    attempts to update a network by adding a portgroup with no name would
    cause libvirtd to segfault. For example:

       virsh net-update default add portgroup "<portgroup default='yes'/>"

    This patch causes virNetworkPortGroupParseXML to fail if no name is
    specified, thus avoiding any later problems.

Comment 5 Huang Wenlong 2012-12-06 05:52:53 UTC
Verify this bug :
libvirt-0.10.2-11.el6.x86_64


#cat net.xml
<network>
  <name>testnet</name>
  <uuid>50dc2e11-2cd7-06e4-8b04-80d9c6649623</uuid>
  <forward mode='route'/>
  <bridge name='testbridge' stp='on' delay='0' />
  <mac address='52:54:00:83:20:D7'/>
  <ip address='192.168.111.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.111.2' end='192.168.111.254' />
    </dhcp>
  </ip>
  <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64'>
  </ip>
  <portgroup name='engineering'>
  </portgroup>
</network>


# virsh net-define net.xml 
Network testnet defined from net.xml

[root@intel-q9400-4-2 ~]# virsh net-update testnet modify portgroup "<portgroup default='no'/>"
error: Failed to update network testnet
error: XML error: Missing required name attribute in portgroup

Comment 6 errata-xmlrpc 2013-02-21 07:27:38 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.