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 1029299 - session libvirtd crashes on nwfilter-define
Summary: session libvirtd crashes on nwfilter-define
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.5
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-12 06:11 UTC by zhengqin
Modified: 2014-10-14 04:18 UTC (History)
11 users (show)

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


Attachments (Terms of Use)
/var/log/messages (28.23 KB, text/plain)
2013-11-12 06:11 UTC, zhengqin
no flags Details


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 zhengqin 2013-11-12 06:11:14 UTC
Created attachment 822767 [details]
/var/log/messages

Description
On latest RHEL6.5, For non-root user, when executing command “virsh nwfilter-define <nwfilterXML>”, libvirtd will crash.


Version:

libvirt-0.10.2-29.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Issue the following command to create a user and set its password:
#useradd non-root ;  passwd non-root

2. Switch to user “non-root” by command “su - non-root”, and prepare a xml file named disallow-arp.xml like below:
-----------------------------------------------------------------
<filter name='disallow-arp1' chain='arp'>
  <rule action='drop' direction='inout' priority='500'/>
</filter>
-----------------------------------------------------------------


3. Execute command “nwfilter-define” under “non-root” user.


Actual results:
[non-root@localhost ~]$ virsh nwfilter-define disallow.xml 
error: Failed to define network filter from disallow.xml
error: End of file while reading data: Input/output error
error: One or more references were leaked after disconnect from the hypervisor
error: Reconnected to the hypervisor


libvirtd crashed when executing nwfilter-define under non-root user.



Expected results:
libvirtd should be worked well, and non-root user should have not permission to define network filter.

Comment 7 zhengqin 2013-11-12 09:20:04 UTC
Modified the title to: 
Memory leaks when executing nwfilter-define under non-root user.

Comment 10 Ján Tomko 2013-11-13 10:54:06 UTC
The crash is caused by a NULL dereference due to the nwfilter driver being only partially initialized if it's not running as root:
#0  __strlen_sse2 () at ../sysdeps/x86_64/strlen.S:32
#1  0x0000003aed681036 in __strdup (s=0x0) at strdup.c:42
---Type <return> to continue, or q <return> to quit---
#2  0x0000003c95e677aa in virFileMakePathWithMode (path=<value optimized out>, mode=511) at util/util.c:1336
#3  0x0000003c95eb9ed9 in virNWFilterObjSaveDef (driver=0x7f42880523e0, nwfilter=0x7f427c0010f0, def=0x7f427c000b30)
    at conf/nwfilter_conf.c:3163
#4  0x00000000004fc3e0 in nwfilterDefine (conn=0x7f4284000bd0, xml=<value optimized out>) at nwfilter/nwfilter_driver.c:574
#5  0x0000003c95ee4ec6 in virNWFilterDefineXML (conn=0x7f4284000bd0, 
    xmlDesc=0x7f427c0009a0 "<filter name='bla' chain='arp'>\n  <rule action='drop' direction='inout' priority='500'/>\n</filter>\n")
    at libvirt.c:16828

On upstream this doesn't crash, it prints an obscure error instead (see bug 1029266). The fix in both cases is to properly disable the nwfilter driver and has been pushed upstream:
commit b7829f959b33c6e32422222a9ed745c0da7dc696
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-11-12 13:18:54 +0100
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-11-13 09:41:57 +0100

    Disable nwfilter driver when running unprivileged
    
    When opening a new connection to the driver, nwfilterOpen
    only succeeds if the driverState has been allocated.
    
    Move the privilege check in driver initialization before
    the state allocation to disable the driver.
    
    This changes the nwfilter-define error from:
    error: cannot create config directory (null): Bad address
    To:
    this function is not supported by the connection driver:
    virNWFilterDefineXML
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1029266

git describe: v1.1.4-79-gb7829f9

Comment 14 Ján Tomko 2014-04-09 08:46:42 UTC
Downstream patch posted:
http://post-office.corp.redhat.com/archives/rhvirt-patches/2014-April/msg00201.html

Comment 16 yanbing du 2014-04-14 09:23:41 UTC
Verify bug with libvirt-0.10.2-32.el6.x86_64

# virsh nwfilter-define nw-filter.xml 
error: Failed to define network filter from nw-filter.xml
error: this function is not supported by the connection driver: virNWFilterDefineXML

This is an expect result, so move bug to VERIFIED.

Comment 18 errata-xmlrpc 2014-10-14 04:18:18 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.