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 2102009 - Attach interface fail will cause unexpected behavior
Summary: Attach interface fail will cause unexpected behavior
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-29 06:04 UTC by yalzhang@redhat.com
Modified: 2022-11-15 10:40 UTC (History)
4 users (show)

Fixed In Version: libvirt-8.5.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 10:04:39 UTC
Type: Bug
Target Upstream Version: 8.5.0
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)
virtqemud coredump file (10.69 KB, text/plain)
2022-06-29 06:04 UTC, yalzhang@redhat.com
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-126552 0 None None None 2022-06-29 06:08:51 UTC
Red Hat Product Errata RHSA-2022:8003 0 None None None 2022-11-15 10:05:06 UTC

Description yalzhang@redhat.com 2022-06-29 06:04:08 UTC
Created attachment 1893327 [details]
virtqemud coredump file

Description of problem:
Attach ovs bridge type interface without virtualport type cause unexpected behavior 

Version-Release number of selected component (if applicable):
libvirt-8.4.0-3.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create an openvswitch type bridge:
# ovs-vsctl add-br ovsbr0
# ovs-vsctl show
fe232443-05ec-475e-baf4-89a14b012b30
    Bridge ovsbr0
        Port ovsbr0
            Interface ovsbr0
                type: internal
    ovs_version: "2.15.6"

2. start a vm, and try to attach a bridge type interface which connected to an ovs bridge:
# virsh start avocado-vt-vm1
Domain 'avocado-vt-vm1' started
# pidof virtqemud
31938
# virsh attach-interface avocado-vt-vm1 bridge ovsbr0 --model virtio
error: Failed to attach interface
error: Unable to add bridge ovsbr0 port vnet4: Operation not supported

This is expected, since ovsbr0 is an ovs bridge which needs to set the <virtualport type='openvswitch'/> in the interface device xml.
But after the command, the dumpxml will fail with error as below

# virsh dumpxml avocado-vt-vm1
error: internal error: unexpected net type -50053111

4. Destroy the vm and then restart the virtqemud service. It will cause Virtqemud coredump.
# virsh destroy avocado-vt-vm1
Domain 'avocado-vt-vm1' destroyed
# pidof virtqemud
31938
# systemctl restart virtqemud
# coredumpctl list
Wed 2022-06-29 13:39:42 CST  31938   0   0 SIGABRT present  /usr/sbin/virtqemud               1.0M

Actual results:
step 3, the dumpxml show unexpected error msg; 
step 4, restart virtqemud will trigger virtqemud coredump.

Expected results:
In step 3, it should show the vm's live xml without the interface, and in step 4, there should be no coredump triggered 

Additional info:
The issue occur since libvirt-8.4.0-1.el9.x86_64, no issue for libvirt-8.3.0-1.el9.x86_64
# rpm -q libvirt
libvirt-8.3.0-1.el9.x86_64
# pidof virtqemud; virsh start avocado-vt-vm1; virsh attach-interface avocado-vt-vm1 bridge ovsbr0 --model virtio;  sleep 2; virsh dumpxml avocado-vt-vm1 | grep /interface -B7; virsh destroy avocado-vt-vm1;  systemctl restart virtqemud;
42516
Domain 'avocado-vt-vm1' started

error: Failed to attach interface
error: Unable to add bridge ovsbr0 port vnet1: Operation not supported
   <interface>
      <mac address='52:54:00:7b:3c:c9'/>
      <source network='default' portid='b27959f5-4535-40a8-9ff1-7ecc19e2fc61' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
Domain 'avocado-vt-vm1' destroyed

# coredumpctl list | grep 42516
# (no outputs)

Comment 1 yalzhang@redhat.com 2022-06-29 10:38:18 UTC
Attach interface fail will cause such issue, another reproduce:

# cat interface.xml
<interface type="network">
<source network="default" />
<filterref filter="noexist-filter" />
<model type="virtio" />
</interface>

# pidof virtqemud
52745

# virsh attach-device avocado-vt-vm1  interface.xml 
error: Failed to attach device from interface.xml
error: internal error: referenced filter 'noexist-filter' is missing

# virsh destroy avocado-vt-vm1
Domain 'avocado-vt-vm1' destroyed

# systemctl restart virtqemud

# coredumpctl list   | grep 52745
Wed 2022-06-29 18:34:23 CST  52745   0   0 SIGABRT present  /usr/sbin/virtqemud                 1.0M

Comment 4 Jaroslav Suchanek 2022-06-30 14:27:48 UTC
Michal, please have a look. Thanks.

Comment 5 Michal Privoznik 2022-07-01 07:46:10 UTC
Patch posted here:

https://listman.redhat.com/archives/libvir-list/2022-July/232668.html

Comment 6 Michal Privoznik 2022-07-01 08:48:53 UTC
Merged upstream as:

commit f3f877cfa6ff444b0c26c8f987bfe60634d0a600
Author:     Michal Prívozník <mprivozn>
AuthorDate: Fri Jul 1 09:03:28 2022 +0200
Commit:     Michal Prívozník <mprivozn>
CommitDate: Fri Jul 1 10:45:26 2022 +0200

    qemu_hotplug: Don't skip cleanup in qemuDomainAttachNetDevice()
    
    Introduced in v8.4.0-rc1~183 but the first real problem
    introduced in v8.4.0-rc1~170, there's a
    qemuBuildInterfaceConnect() call inside of
    qemuDomainAttachNetDevice(). If the former fails, then the
    function is immediately returned from instead of jumping onto the
    cleanup label. This is crucial, because at this point the domain
    definition contains 'borrowed' net definition, which is then
    freed, since an error was met. The domain definition is then left
    with a dangling pointer which leads to all sorts of different
    crashes.
    
    Fixes: 29d022b1eb7b2330ed224a08509e6d3a5eeecc53
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2102009
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Jiri Denemark <jdenemar>


v8.5.0-rc2-7-gf3f877cfa6

Comment 7 yalzhang@redhat.com 2022-07-04 00:29:47 UTC
Test with libvirt-8.5.0-1.el9.x86_64 and comment 1, the issue is fixed.

# pidof virtqemud
58724

# virsh attach-device avocado-vt-vm1  interface.xml 
error: Failed to attach device from interface.xml
error: internal error: referenced filter 'noexist-filter' is missing

# virsh dumpxml avocado-vt-vm1 | grep /interface -B7
<interface type='network'>
      <mac address='52:54:00:7b:3c:c9'/>
      <source network='default' portid='80515b34-12f1-4312-9a46-8ac7ae1744bc' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>

# systemctl restart virtqemud
# coredumpctl list | grep 58724
(no outputs)

Comment 11 yalzhang@redhat.com 2022-07-08 01:38:04 UTC
Test with the same steps in comment 7 with libvirt-8.5.0-1.el9.x86_64, the issue is fixed.

Comment 13 errata-xmlrpc 2022-11-15 10:04:39 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 (Low: libvirt security, bug fix, and enhancement update), 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/RHSA-2022:8003


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