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 884382 - list_all_interfaces can not list any interfaces with default flag
Summary: list_all_interfaces can not list any interfaces with default flag
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.4
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-06 05:49 UTC by weizhang
Modified: 2016-04-26 16:07 UTC (History)
7 users (show)

Fixed In Version: libvirt-0.10.2-33.el6
Doc Type: Bug Fix
Doc Text:
Clone Of: 883775
Environment:
Last Closed: 2014-10-14 04:14:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1374 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2014-10-14 08:11:54 UTC

Description weizhang 2012-12-06 05:49:08 UTC
This bug is only for the part of list_all_interfaces

+++ This bug was initially created as a clone of Bug #883775 +++

Description of problem:
when test list_all_interface and list_all_nwfilters, found that list_all_interface with default flag can not list any host interfaces
and for list_all_nwfilters, seems return the wrong object
Sys::Virt::NWFilters, which should be Sys::Virt::NWFilter without 's'


Version-Release number of selected component (if applicable):
perl-Sys-Virt-0.10.2-4.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
run perl script

#!/usr/bin/perl
use warnings;
use strict;
use Sys::Virt;

my $uri = "qemu:///system";
my $con = Sys::Virt->new(address => $uri, readonly => 0);

my @ifaces = $con->list_all_interfaces();
foreach my $if (@ifaces){
    print "$if\n";
}

my @nwlist = $con->list_all_nwfilters();
foreach my $nw (@nwlist){
    print "$nw\n";
}

  
Actual results:
list_all_interfaces can not list any interfaces
list_all_nwfilters return Sys::Virt::NWFilters but not Sys::Virt::NWFilter

Expected results:
list_all_interfaces with default flag can list interfaces
list_all_nwfilters return Sys::Virt::NWFilter

Additional info:

--- Additional comment from Daniel Berrange on 2012-12-05 14:40:06 EST ---

The issue with list_all_nwfilters is a bug in the Perl binding. The issue with list_all_interfaces appears to be a libvirt bug - please file another BZ for that.

Comment 2 Gunannan Ren 2013-05-20 13:43:57 UTC
flags with 0 can not list interfaces, use flags in libvirt.h
by default to list all of active and inactive interfaces

 VIR_CONNECT_LIST_INTERFACES_INACTIVE = 1 << 0
 VIR_CONNECT_LIST_INTERFACES_ACTIVE   = 1 << 1

patch sent
https://www.redhat.com/archives/libvir-list/2013-May/msg01415.html

Comment 3 Gunannan Ren 2013-05-22 01:51:40 UTC
It's not perl binding's issue, we need to fix it on libvirt side to keep the behaviour of virConnectListAllInterfaces consistent with other virConnectListAll APIs, the flag of 0 should list all of objects. other flags only generate a subset.


commit 7ac2c4fe624f30f2c8270116513fa2ddab07631f
Author: Guannan Ren <gren>
Date:   Tue May 21 21:29:38 2013 +0800

    interface: list all interfaces with flags == 0
    
    virConnectListAllInterfaces should support to list all of
    interfaces when the value of flags is 0. The behaviour is
    consistent with other virConnectListAll* APIs

Comment 6 Michal Privoznik 2013-10-16 09:13:40 UTC
We need a follow up patches:

commit 1f9dcbc7f1ad828a7233a1c04ad73734a02a399d
Author:     Osier Yang <jyang>
AuthorDate: Wed May 22 13:12:34 2013 +0800
Commit:     Osier Yang <jyang>
CommitDate: Wed May 22 13:14:31 2013 +0800

    Fix the syntax-check failure
    
    Introduced by commit 7ac2c4fe624, pushed under build-breaker rule.

commit 244e0b8cf15ca2ef48d82058e728656e6c4bad11
Author:     Daniel P. Berrange <berrange>
AuthorDate: Fri Jun 28 13:21:33 2013 +0100
Commit:     Daniel Veillard <veillard>
CommitDate: Mon Jul 1 15:05:24 2013 +0800

    Crash of libvirtd by unprivileged user in virConnectListAllInterfaces
    
    On Thu, Jun 27, 2013 at 03:56:42PM +0100, Daniel P. Berrange wrote:
    > Hi Security Team,
    >
    > I've discovered a way for an unprivileged user with a readonly connection
    > to libvirtd, to crash the daemon.
    
    Ok, the final patch for this is issue will be the simpler variant that
    Eric suggested
    
    The embargo can be considered to be lifted on Monday July 1st, at
    0900 UTC
    
    The following is the GIT change that DV or myself will apply to libvirt
    GIT master immediately before the 1.1.0 release:
    
    >From 177b4165c531a4b3ba7f6ab6aa41dca9ceb0b8cf Mon Sep 17 00:00:00 2001
    From: "Daniel P. Berrange" <berrange>
    Date: Fri, 28 Jun 2013 10:48:37 +0100
    Subject: [PATCH] CVE-2013-2218: Fix crash listing network interfaces with
     filters
    
    The virConnectListAllInterfaces method has a double-free of the
    'struct netcf_if' object when any of the filtering flags cause
    an interface to be skipped over. For example when running the
    command 'virsh iface-list --inactive'
    
    This is a regression introduced in release 1.0.6 by
    
      commit 7ac2c4fe624f30f2c8270116513fa2ddab07631f
      Author: Guannan Ren <gren>
      Date:   Tue May 21 21:29:38 2013 +0800
    
        interface: list all interfaces with flags == 0
    
    Signed-off-by: Daniel P. Berrange <berrange>

Comment 12 Cui Lei 2014-07-08 08:30:40 UTC
I can reproduce this issue with:
libvirt-0.10.2-29.el6.x86_64
perl-Sys-Virt-0.10.2-4.el6.x86_64

After execute the perl script, get the result as return Sys::Virt::NWFilters, details is:
Sys::Virt::NWFilters=SCALAR(0x1955f40)
Sys::Virt::NWFilters=SCALAR(0x1adcf28)
Sys::Virt::NWFilters=SCALAR(0x1adcf58)
Sys::Virt::NWFilters=SCALAR(0x1adcf88)
Sys::Virt::NWFilters=SCALAR(0x1adcfb8)
Sys::Virt::NWFilters=SCALAR(0x1adcfe8)
Sys::Virt::NWFilters=SCALAR(0x1add018)
Sys::Virt::NWFilters=SCALAR(0x1add048)
Sys::Virt::NWFilters=SCALAR(0x1add078)
Sys::Virt::NWFilters=SCALAR(0x1ad8f50)
Sys::Virt::NWFilters=SCALAR(0x1ad8f80)
Sys::Virt::NWFilters=SCALAR(0x1ad8fb0)
Sys::Virt::NWFilters=SCALAR(0x1ad8fe0)
Sys::Virt::NWFilters=SCALAR(0x1ad9010)
Sys::Virt::NWFilters=SCALAR(0x1ad9040)
Sys::Virt::NWFilters=SCALAR(0x1ad9070)
Sys::Virt::NWFilters=SCALAR(0x1ad90a0)

I verified the issue with:
libvirt-0.10.2-40.el6.x86_64
perl-Sys-Virt-0.10.2-5.el6.x86_64

After execute the perl script, get the result as return Sys::Virt::NWFilter
Sys::Virt::NWFilter=SCALAR(0xef2d78)
Sys::Virt::NWFilter=SCALAR(0x107a528)
Sys::Virt::NWFilter=SCALAR(0x107a558)
Sys::Virt::NWFilter=SCALAR(0x107a588)
Sys::Virt::NWFilter=SCALAR(0x107a5b8)
Sys::Virt::NWFilter=SCALAR(0x107a5e8)
Sys::Virt::NWFilter=SCALAR(0x107a618)
Sys::Virt::NWFilter=SCALAR(0x107a648)
Sys::Virt::NWFilter=SCALAR(0x107a678)
Sys::Virt::NWFilter=SCALAR(0x107a6a8)
Sys::Virt::NWFilter=SCALAR(0x1076650)
Sys::Virt::NWFilter=SCALAR(0x1076680)
Sys::Virt::NWFilter=SCALAR(0x10766b0)
Sys::Virt::NWFilter=SCALAR(0x10766e0)
Sys::Virt::NWFilter=SCALAR(0x1076710)
Sys::Virt::NWFilter=SCALAR(0x1076740)
Sys::Virt::NWFilter=SCALAR(0x1076770)
Sys::Virt::NWFilter=SCALAR(0x10767a0)

So change the status from 'ON_QA' to 'VERIFIED'

Comment 14 errata-xmlrpc 2014-10-14 04:14:31 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, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1374.html


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