Bug 2092856

Summary: Hotplug interface fail with null file descriptor
Product: Red Hat Enterprise Linux 9 Reporter: yalzhang <yalzhang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
libvirt sub component: Networking QA Contact: yalzhang <yalzhang>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: medium CC: apevec, berrange, bugproxy, jdenemar, jsuchane, lcheng, lmen, lvivier, mmarusak, mpitt, smitterl, smooney, tstaudt, virt-maint
Version: 9.1Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard: CockpitTest
Fixed In Version: libvirt-8.4.0-3.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:04:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 8.5.0

Description yalzhang@redhat.com 2022-06-02 11:31:13 UTC
Description:
Hotplug interface fail with null file descriptor

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

How reproducible:
100%

Steps to Reproduce:
1. start a vm

2. try to hotplug an interface
# virsh attach-interface rhel network default --model virtio
error: Failed to attach interface
error: internal error: unable to execute QEMU command 'netdev_add': File descriptor named '(null)' has not been found

3. check the libvirt log:
# cat /var/log/libvirt/libvirtd.log 
...
2022-06-02 06:48:00.398+0000: 413311: info : qemuMonitorSend:887 : QEMU_MONITOR_SEND_MSG: mon=0x5597c0ac42f0 msg={"execute":"netdev_add","arguments":{"type":"tap","fd":"(null)","vhost":true,"vhostfd":"(null)","id":"hostnet1"},"id":"libvirt-419"}
 fd=-1
2022-06-02 06:48:00.398+0000: 414565: info : virObjectRef:402 : OBJECT_REF: obj=0x5597c0ac42f0
2022-06-02 06:48:00.398+0000: 414565: info : qemuMonitorIOWrite:383 : QEMU_MONITOR_IO_WRITE: mon=0x5597c0ac42f0 buf={"execute":"netdev_add","arguments":{"type":"tap","fd":"(null)","vhost":true,"vhostfd":"(null)","id":"hostnet1"},"id":"libvirt-419"}
 len=134 ret=134 errno=0
2022-06-02 06:48:00.398+0000: 414565: info : virObjectRef:402 : OBJECT_REF: obj=0x5597c0ac42f0
2022-06-02 06:48:00.398+0000: 414565: info : virObjectUnref:380 : OBJECT_UNREF: obj=0x5597c0ac42f0
2022-06-02 06:48:00.398+0000: 414565: info : virObjectUnref:380 : OBJECT_UNREF: obj=0x5597c0ac42f0
2022-06-02 06:48:00.399+0000: 414565: info : virObjectRef:402 : OBJECT_REF: obj=0x5597c0ac42f0
2022-06-02 06:48:00.399+0000: 414565: info : qemuMonitorJSONIOProcessLine:218 : QEMU_MONITOR_RECV_REPLY: mon=0x5597c0ac42f0 reply={"id": "libvirt-419", "error": {"class": "GenericError", "desc": "File descriptor named '(null)' has not been found"}}

Actual results:
Hotplug interface fail with null file descriptor

Expected results:
Hotplug interface should succeed

Additional info:

Comment 1 Peter Krempa 2022-06-06 08:06:30 UTC
commit 8d3a807a4acce72a9bce50dd6496c7e320cace39 
Author: Peter Krempa <pkrempa>
Date:   Fri Jun 3 15:49:01 2022 +0200

    qemu: fd: Fix monitor usage of qemuFDPassDirectGetPath
    
    We need to use the 'name' variable and just overwrite it with the FD
    number when FDs are passed on the monitor. Otherwise we will read NULL
    path if the FD is accessed before being passed on the monitor. The idea
    of this helper is to simplify the monitor code so it would be
    counterproductive to have other behaviour.
    
    Fixes the following symptom:
    
     $ virsh attach-interface cd network default --model virtio
     error: Failed to attach interface
     error: internal error: unable to execute QEMU command 'netdev_add': File descriptor named '(null)' has not been found
    
    Fixes: bca9047906fd73fd30f275dd45b64998fbbcf6de
    Resolves: https://gitlab.com/libvirt/libvirt/-/issues/318
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2092856
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

v8.4.0-87-g8d3a807a4a

Comment 2 yalzhang@redhat.com 2022-06-07 03:38:19 UTC
test on v8.4.0-88-g95bd137216, the bug is fixed.

Comment 9 Laurent Vivier 2022-06-22 13:29:12 UTC
Setting priority for triage in our Kanban board ("medium", please update if not appropriate)

Comment 12 yalzhang@redhat.com 2022-06-29 10:44:21 UTC
Test on libvirt-8.4.0-3.el9.x86_64 and check the auto jobs, the bug is fixed.

Comment 14 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