Red Hat Bugzilla – Bug 1182486
libvirtd crashed when updating a IPv6 <host> and a IPv4 <host> into a IPv4 <ip> element
Last modified: 2015-03-05 02:49:12 EST
Description of problem: libvirtd crashed when updating a IPv6 <host> and a IPv4 <host> into a IPv4 <ip> element Version-Release number of selected component (if applicable): libvirt-1.2.8-12.el7.x86_64 How reproducible: 100% Steps to Reproduce: [root@localhost ~]# virsh net-list Name State Autostart Persistent ---------------------------------------------------------- default active yes yes [root@localhost ~]# cat libvirt-test-API/repos/network/xmls/ip-dhcp-host.xml <host mac="00:16:3e:77:e2:ed" name="foo.example.com" ip="192.168.122.10" /> [root@localhost ~]# cat libvirt-test-API/repos/network/xmls/ipv6-dhcp-host.xml <host id='00:04:58:fd:e4:15:1b:09:4c:0e:09:af:e4:d3:8c:b8:ca:1e' name="redhatipv6.redhat.com" ip='2001:db8:ca2:2::119'/> [root@localhost ~]# virsh net-dumpxml default <network> <name>default</name> <uuid>ac3350be-5fa1-405c-b19f-cf0ef7c81263</uuid> <forward mode='nat'> <nat> <port start='1024' end='65535'/> </nat> </forward> <bridge name='virbr0' stp='on' delay='0'/> <mac address='52:54:00:15:e9:3a'/> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.122.2' end='192.168.122.254'/> </dhcp> </ip> <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:2::100' end='2001:db8:ca2:2::1ff'/> </dhcp> </ip> </network> [root@localhost ~]# virsh net-update default add-first ip-dhcp-host libvirt-test-API/repos/network/xmls/ipv6-dhcp-host.xml --parent-index 0 Updated network default live state [root@localhost ~]# virsh net-update default add-first ip-dhcp-host libvirt-test-API/repos/network/xmls/ip-dhcp-host.xml --parent-index 0 error: Failed to update network default error: internal error: received hangup / error event on socket error: Failed to reconnect to the hypervisor Actual results: As shown above steps. Expected results: Should prevent such behavior. Additional info: 1. [root@jiahu libvirt-test-API]# virsh net-update default add-first ip-dhcp-host modify-ip-dhcp-host.xml --parent-index 1 error: Failed to update network default error: XML error: Invalid to specify MAC address '00:16:3e:77:e2:ed' in network 'default' IPv6 static host definition
Created attachment 980379 [details] All back trace for the bug
Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2015-January/msg00546.html
I've just pushed the patch upstream: commit 7d3ae359db604f6052247ad49d7fbce1db7ef99c Author: Michal Privoznik <mprivozn@redhat.com> AuthorDate: Thu Jan 15 15:42:04 2015 +0100 Commit: Michal Privoznik <mprivozn@redhat.com> CommitDate: Fri Jan 16 09:57:05 2015 +0100 virNetworkDefUpdateIPDHCPHost: Don't crash when updating network https://bugzilla.redhat.com/show_bug.cgi?id=1182486 When updating a network and adding new ip-dhcp-host entry, the deamon may crash. The problem is, we iterate over existing <host/> entries trying to compare MAC addresses to see if there's already an existing rule. However, not all entries are required to have MAC address. For instance, the following is perfectly valid entry: <host id='00:04:58:fd:e4:15:1b:09:4c:0e:09:af:e4:d3:8c:b8:ca:1e' name='redhatipv6.redhat.com' ip='2001:db8:ca2:2::119'/> When the checking loop iterates over this, the entry's MAC address is accessed directly. Well, the fix is obvious - check if the address is defined before trying to compare it. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> v1.2.11-177-g7d3ae35
And moving to POST: http://post-office.corp.redhat.com/archives/rhvirt-patches/2015-January/msg00360.html
I can not reproduce it on below version. [root@ibm-x3850x5-06 ~]# rpm -q libvirt libvirt-1.2.8-15.el7.x86_64 [root@ibm-x3850x5-06 ~]# cat ip-dhcp-host.xml <host mac='52:54:00:cb:17:00' name='jiahu.example.com' ip='192.168.122.10'/> [root@ibm-x3850x5-06 ~]# cat ipv6-dhcp-host.xml <host id='00:04:58:fd:e4:15:1b:09:4c:0e:09:af:e4:d3:8c:b8:ca:1e' name="redhatipv6.redhat.com" ip='2001:db8:ca2:2::119'/> [root@ibm-x3850x5-06 ~]# cat 123.sh service libvirtd status virsh net-update default add-first ip-dhcp-host ipv6-dhcp-host.xml --parent-index 0 virsh net-update default add-first ip-dhcp-host ip-dhcp-host.xml --parent-index 0 virsh net-dumpxml default virsh net-update default delete ip-dhcp-host ip-dhcp-host.xml --parent-index 0 virsh net-update default delete ip-dhcp-host ipv6-dhcp-host.xml --parent-index 0 virsh net-dumpxml default service libvirtd status [root@ibm-x3850x5-06 ~]# sh 123.sh Redirecting to /bin/systemctl status libvirtd.service libvirtd.service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled) Active: active (running) since Thu 2015-01-22 14:29:32 CST; 54min ago Docs: man:libvirtd(8) http://libvirt.org Main PID: 12683 (libvirtd) CGroup: /system.slice/libvirtd.service ├─12224 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --dhcp-script=/usr/libexec/libvirt_leaseshelper ├─12225 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --dhcp-script=/usr/libexec/libvirt_leaseshelper ├─12329 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/test1.conf --dhcp-script=/usr/libexec/libvirt_leaseshelper ├─12330 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/test1.conf --dhcp-script=/usr/libexec/libvirt_leaseshelper └─12683 /usr/sbin/libvirtd Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq-dhcp[12224]: read /var/lib/libvirt/dnsmasq/default.hostsfile Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /etc/hosts - 2 addresses Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq-dhcp[12224]: read /var/lib/libvirt/dnsmasq/default.hostsfile Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /etc/hosts - 2 addresses Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq-dhcp[12224]: read /var/lib/libvirt/dnsmasq/default.hostsfile Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /etc/hosts - 2 addresses Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jan 22 15:22:43 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq-dhcp[12224]: read /var/lib/libvirt/dnsmasq/default.hostsfile Updated network default live state Updated network default live state <network> <name>default</name> <uuid>6d4f9a7b-d8bc-4150-a891-46019e4c99a5</uuid> <forward mode='nat'> <nat> <port start='1024' end='65535'/> </nat> </forward> <bridge name='virbr0' stp='on' delay='0'/> <mac address='52:54:00:42:e5:99'/> <domain name='example.com'/> <dns> <forwarder addr='8.8.8.8'/> <forwarder addr='8.8.4.4'/> <txt name='hjw' value='redhat jiahu'/> </dns> <ip address='192.168.122.1' netmask='255.255.0.0'> <dhcp> <range start='192.168.1.2' end='192.168.5.254'/> <host mac='52:54:00:cb:17:00' name='jiahu.example.com' ip='192.168.122.10'/> <host id='00:04:58:fd:e4:15:1b:09:4c:0e:09:af:e4:d3:8c:b8:ca:1e' name='redhatipv6.redhat.com' ip='2001:db8:ca2:2::119'/> </dhcp> </ip> <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:2::100' end='2001:db8:ca2:2::1ff'/> </dhcp> </ip> </network> Updated network default live state Updated network default live state <network> <name>default</name> <uuid>6d4f9a7b-d8bc-4150-a891-46019e4c99a5</uuid> <forward mode='nat'> <nat> <port start='1024' end='65535'/> </nat> </forward> <bridge name='virbr0' stp='on' delay='0'/> <mac address='52:54:00:42:e5:99'/> <domain name='example.com'/> <dns> <forwarder addr='8.8.8.8'/> <forwarder addr='8.8.4.4'/> <txt name='hjw' value='redhat jiahu'/> </dns> <ip address='192.168.122.1' netmask='255.255.0.0'> <dhcp> <range start='192.168.1.2' end='192.168.5.254'/> </dhcp> </ip> <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64'> <dhcp> <range start='2001:db8:ca2:2::100' end='2001:db8:ca2:2::1ff'/> </dhcp> </ip> </network> Redirecting to /bin/systemctl status libvirtd.service libvirtd.service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled) Active: active (running) since Thu 2015-01-22 14:29:32 CST; 54min ago Docs: man:libvirtd(8) http://libvirt.org Main PID: 12683 (libvirtd) CGroup: /system.slice/libvirtd.service ├─12224 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --dhcp-script=/usr/libexec/libvirt_leaseshelper ├─12225 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --dhcp-script=/usr/libexec/libvirt_leaseshelper ├─12329 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/test1.conf --dhcp-script=/usr/libexec/libvirt_leaseshelper ├─12330 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/test1.conf --dhcp-script=/usr/libexec/libvirt_leaseshelper └─12683 /usr/sbin/libvirtd Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq-dhcp[12224]: read /var/lib/libvirt/dnsmasq/default.hostsfile Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /etc/hosts - 2 addresses Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq-dhcp[12224]: read /var/lib/libvirt/dnsmasq/default.hostsfile Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /etc/hosts - 2 addresses Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq-dhcp[12224]: read /var/lib/libvirt/dnsmasq/default.hostsfile Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /etc/hosts - 2 addresses Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq[12224]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jan 22 15:24:26 ibm-x3850x5-06.qe.lab.eng.nay.redhat.com dnsmasq-dhcp[12224]: read /var/lib/libvirt/dnsmasq/default.hostsfile [root@ibm-x3850x5-06 ~]# Can not hit the libvirtd crash, regarding the ipv6 <host> in wrong <ip> section, I filed a new bug to track it. Bug 1184736 - libvirt should verify proper address family of <host> when updating network
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/RHSA-2015-0323.html