Description of problem: a) <teaming> element leaks the persistent string b) typo in formatdomain.html Version-Release number of selected component (if applicable): libvirt-6.0.0-3.el8 Steps to Reproduce: 1. cat >xml <EOF <domain type='qemu'> <name>leak</name> <memory unit='KiB'>219100</memory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='pc'>hvm</type> </os> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <interface type='user'> <mac address='00:11:22:33:44:55'/> <model type='virtio'/> <teaming type='transient' persistent='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'/> <alias name='ua-backup0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> </devices> </domain> EOF 2. while true; do virsh define xml; done (This fails to parse, but still reproduces the memory leak) Actual results: a) libvirtd's memory usage grows b) grep axnd /usr/share/doc/libvirt-docs/html/formatdomain.html; echo $? QEMU 4.2.0 or newer axnd a guest virtio-net driver supporting 0 Expected results: a) libvirtd's memory usage does not grow b) grep axnd /usr/share/doc/libvirt-docs/html/formatdomain.html ; echo $? 1 Additional info: valgrind trace from qemuxml2argvtest: ==119642== 22 bytes in 2 blocks are definitely lost in loss record 178 of 671 ==119642== at 0x483579F: malloc (vg_replace_malloc.c:309) ==119642== by 0x58F89F1: xmlStrndup (in /usr/lib64/libxml2.so.2.9.9) ==119642== by 0x4BA3B74: virXMLPropString (virxml.c:520) ==119642== by 0x4BDB0C5: virDomainNetDefParseXML (domain_conf.c:11876) ==119642== by 0x4BF9EF4: virDomainDefParseXML (domain_conf.c:21196) ==119642== by 0x4BFCD5B: virDomainDefParseNode (domain_conf.c:21943) ==119642== by 0x4BFCC36: virDomainDefParse (domain_conf.c:21901) ==119642== by 0x4BFCCCB: virDomainDefParseFile (domain_conf.c:21924) ==119642== by 0x114A9D: testCompareXMLToArgv (qemuxml2argvtest.c:452) ==119642== by 0x13894F: virTestRun (testutils.c:143) ==119642== by 0x11F46E: mymain (qemuxml2argvtest.c:1316) ==119642== by 0x13A60E: virTestMain (testutils.c:839)
Fixed upstream by: commit 5b63cb5abff09882feda8e333285259aecc8e9e8 docs: fix a typo git describe: v6.0.0-245-g5b63cb5abf commit 2ab278ec758b09398ea335626a41b453cdda6da7 virDomainNetDefClear: Free @persistent name git describe: v6.0.0-435-g2ab278ec75
Verify this bug with libvirt-daemon-6.0.0-10.module+el8.2.0+5984+dce93708.x86_64: A test no memory leak when parse xml 1. prepare xml like this bug description's xml: # cat guest.xml <domain type='qemu'> <name>leak</name> <memory unit='KiB'>219100</memory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='pc'>hvm</type> </os> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <interface type='user'> <mac address='00:11:22:33:44:55'/> <model type='virtio'/> <teaming type='transient' persistent='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'/> <alias name='ua-backup0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> </devices> </domain> 2. Use valgrind start libvirtd in another terminal: # valgrind --leak-check=full libvirtd 3. # virsh define guest.xml error: Failed to define domain from guest.xml error: unsupported configuration: virtio-net teaming transient interface must be type='hostdev', not 'user' 4. check valgrind output and there is no memory leak like this: ==119642== 22 bytes in 2 blocks are definitely lost in loss record 178 of 671 ==119642== at 0x483579F: malloc (vg_replace_malloc.c:309) ==119642== by 0x58F89F1: xmlStrndup (in /usr/lib64/libxml2.so.2.9.9) ==119642== by 0x4BA3B74: virXMLPropString (virxml.c:520) ==119642== by 0x4BDB0C5: virDomainNetDefParseXML (domain_conf.c:11876) ==119642== by 0x4BF9EF4: virDomainDefParseXML (domain_conf.c:21196) ==119642== by 0x4BFCD5B: virDomainDefParseNode (domain_conf.c:21943) ==119642== by 0x4BFCC36: virDomainDefParse (domain_conf.c:21901) ==119642== by 0x4BFCCCB: virDomainDefParseFile (domain_conf.c:21924) ==119642== by 0x114A9D: testCompareXMLToArgv (qemuxml2argvtest.c:452) ==119642== by 0x13894F: virTestRun (testutils.c:143) ==119642== by 0x11F46E: mymain (qemuxml2argvtest.c:1316) ==119642== by 0x13A60E: virTestMain (testutils.c:839) B verify typo issue in domain docs # grep axnd /usr/share/doc/libvirt-docs/html/formatdomain.html ; echo $? 1
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://access.redhat.com/errata/RHBA-2020:2017