RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 988718 - libvirtd crash when delete srv only passing one mandatory attributes via virsh net-update
Summary: libvirtd crash when delete srv only passing one mandatory attributes via virs...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-26 08:44 UTC by hongming
Modified: 2016-06-14 02:07 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.1.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 10:34:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
libvirt debug log (5.72 MB, text/plain)
2013-07-26 08:47 UTC, hongming
no flags Details

Description hongming 2013-07-26 08:44:33 UTC
Description of problem:
libvirtd crash when delete srv only passing one mandatory attributes via virsh net-update


Version-Release number of selected component (if applicable):
libvirt-1.1.0-2.el7.x86_64
kernel-3.10.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
# virsh net-list
  Name                 State      Autostart     Persistent
----------------------------------------------------------
  default              active     yes           yes
  network              active     no            yes

# virsh net-dumpxml network
<network>
   <name>network</name>
   <uuid>2531df5b-adf0-471f-95f7-68d627053342</uuid>
   <bridge name='virbr2' stp='on' delay='0' />
   <mac address='52:54:00:90:a1:29'/>
   <domain name='example.com'/>
   <dns>
     <txt name='example' value='example value' />
     <srv service='name' protocol='tcp' domain='test-domain-name' 
target='englab.nay.redhat.com' port='1024' priority='10' weight='10'/>
     <host ip='192.168.10.2'>
       <hostname>myhost</hostname>
       <hostname>myhostalias</hostname>
     </host>
   </dns>
   <ip address='192.168.10.1' netmask='255.255.255.0'>
     <dhcp>
       <range start='192.168.10.2' end='192.168.10.254' />
     </dhcp>
   </ip>
</network>

# virsh net-update network delete dns-srv "<srv service='name'/>"
error: Failed to update network network
error: End of file while reading data: Input/output error
error: One or more references were leaked after disconnect from the 
hypervisor
error: Failed to reconnect to the hypervisor

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh net-list
  Name                 State      Autostart     Persistent
----------------------------------------------------------
  default              active     yes           yes
  network              active     no            yes

# virsh net-update network delete dns-srv "<srv protocol='tcp'/>"
error: Failed to update network network
error: End of file while reading data: Input/output error
error: One or more references were leaked after disconnect from the 
hypervisor
error: Failed to reconnect to the hypervisor.

Actual results:
libvirtd crash when delete srv only passing one mandatory attributes via 
virsh net-update

Expected results:
libvirtd works fine and throw error

Additional info:

Comment 1 hongming 2013-07-26 08:47:25 UTC
Created attachment 778706 [details]
libvirt debug log

Comment 3 Ján Tomko 2013-07-26 10:29:13 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2013-July/msg01711.html

Comment 4 Ján Tomko 2013-07-26 11:08:44 UTC
Now fixed upstream:
commit 461fd86a661f32a9aa8044190b2a63b05290332f
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-07-26 12:11:21 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-07-26 12:53:45 +0200

    Don't check validity of missing attributes in DNS SRV XML
    
    This fixes a crash if one of them is missing.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=988718

git describe: v1.1.1-rc1-35-g461fd86


virsh net-update default delete dns-host "<host protocol='name'/>"
was also crashing if there were no dns host records in the network, fixed by:
commit c4e23388e6c7f769e45d1c162f880cd81e4d4d3b
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-07-26 12:04:32 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-07-26 12:50:34 +0200

    Set the number of elements 0 in virNetwork*Clear
    
    Decrementing it when it was already 0 causes an invalid free
    in virNetworkDefUpdateDNSHost if virNetworkDNSHostDefParseXML
    fails and virNetworkDNSHostDefClear gets called twice.
    
    virNetworkForwardDefClear left the number untouched even if it
    freed all the elements.

git describe: v1.1.1-rc1-34-gc4e2338

Comment 5 yanbing du 2013-07-31 06:57:18 UTC
Verify this bug with libvirt-1.1.1-1.el7.x86_64.
Following the reproduce steps in comment0:
Create/Define,start a libvirt network
# virsh net-list
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     yes           yes
 network              active     no            no

# virsh net-update network delete dns-srv "<srv service='name'/>"
Updated network network live state

# virsh net-dumpxml network
<network>
  <name>network</name>
  <uuid>2531df5b-adf0-471f-95f7-68d627053342</uuid>
  <bridge name='virbr2' stp='on' delay='0' />
  <mac address='52:54:00:90:a1:29'/>
  <domain name='example.com'/>
  <dns>
    <txt name='example' value='example value' />
    <host ip='192.168.10.2'>
      <hostname>myhost</hostname>
      <hostname>myhostalias</hostname>
    </host>
  </dns>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.10.2' end='192.168.10.254' />
    </dhcp>
  </ip>
</network>
# virsh net-update network add dns-srv "<srv service='name' protocol='tcp'/>"
Updated network network live state

# virsh net-update network delete dns-txt "<txt name='example' value='example value'/>"
Updated network network live state

Comment 6 Ludek Smid 2014-06-13 10:34:46 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Comment 8 yalzhang@redhat.com 2016-05-20 06:11:29 UTC
Hi jtomko,

As comment 5 above, it indicates that the dns-srv, dns-txt, dns-host(I have tried) can be updated by the command net-update. But in fact, it can not take effect immediately. Perhaps it needs to re-run dnsmasq to pick up the changes just like update ip-dhcp-range. what do you think about it?

# virsh net-dumpxml network
<network>
  <name>network</name>
  <uuid>2531df5b-adf0-471f-95f7-68d627053342</uuid>
  <bridge name='virbr2' stp='on' delay='0'/>
  <mac address='52:54:00:90:a1:29'/>
  <domain name='example.com'/>
  <dns>
    <txt name='example' value='example value'/>
    <srv service='name' protocol='tcp' domain='test-domain-name' target='englab.nay.redhat.com' port='1024' priority='10' weight='10'/>
    <host ip='192.168.10.2'>
      <hostname>myhost</hostname>
      <hostname>myhostalias</hostname>
    </host>
  </dns>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.10.2' end='192.168.10.254'/>
    </dhcp>
  </ip>
</network>
# virsh net-update network delete dns-srv "<srv service='name' protocol='tcp'/>"
Updated network network live state
# virsh net-update network delete dns-txt "<txt name='example'/>"
Updated network network live state
# virsh net-dumpxml network
<network>
  <name>network</name>
  <uuid>2531df5b-adf0-471f-95f7-68d627053342</uuid>
  <bridge name='virbr2' stp='on' delay='0'/>
  <mac address='52:54:00:90:a1:29'/>
  <domain name='example.com'/>
  <dns>
    <host ip='192.168.10.2'>
      <hostname>myhost</hostname>
      <hostname>myhostalias</hostname>
    </host>
  </dns>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.10.2' end='192.168.10.254'/>
    </dhcp>
  </ip>
</network>
# cat /var/lib/libvirt/dnsmasq/network.conf
##WARNING:  THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
##OVERWRITTEN AND LOST.  Changes to this configuration should be made using:
##    virsh net-edit network
## or other application using the libvirt API.
##
## dnsmasq conf file created by libvirt
strict-order
domain=example.com
expand-hosts
pid-file=/var/run/libvirt/network/network.pid
except-interface=lo
bind-dynamic
interface=virbr2
dhcp-option=3
no-resolv
txt-record=example,example value
srv-host=_name._tcp.test-domain-name,englab.nay.redhat.com,1024,10,10
dhcp-range=192.168.10.2,192.168.10.254
dhcp-no-override
dhcp-lease-max=253
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/network.hostsfile
addn-hosts=/var/lib/libvirt/dnsmasq/network.addnhosts

The txt and srv still exists in the network.conf file after delete. And still can parse correctly in the guest.

Comment 9 yalzhang@redhat.com 2016-05-25 00:28:31 UTC
comment 8 test on libvirt-1.3.4-1.el7.x86_64

Comment 10 Ján Tomko 2016-05-31 15:20:24 UTC
Yes, it is possible libvirtd forgot to write the config file. That is unrelated to this bug about libvirtd crashing, please file a separate one.

Comment 11 Laine Stump 2016-05-31 15:56:56 UTC
I haven't seen a separate bug filed yet, but I do see the source of the problem and have posted a patch upstream:

https://www.redhat.com/archives/libvir-list/2016-May/msg02122.html

If you do file a bug, please note this patch email and assign it to me.

Comment 12 yalzhang@redhat.com 2016-06-14 02:07:03 UTC
file Bug 1341460 to track the issue in comment 8.


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