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 1174147 - uninitialised byte for virDomainOpenGraphicsFD
Summary: uninitialised byte for virDomainOpenGraphicsFD
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-15 09:15 UTC by Jincheng Miao
Modified: 2015-11-19 05:58 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.14-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:58:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Jincheng Miao 2014-12-15 09:15:15 UTC
Description of problem:
valgrind reports uninitialised byte for virDomainOpenGraphicsFD

Version-Release number of selected component (if applicable):
libvirt-1.2.8-9.el7.x86_64
qemu-kvm-rhev-2.1.2-13.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. run libvirt in valgrind
# valgrind --leak-check=full libvirtd

2. call virDomainOpenGraphicsFD
# python
Python 2.7.5 (default, Feb 11 2014, 07:46:25)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> con=libvirt.open(None)
>>> dom=con.lookupByName("r70")
>>> dom.openGraphicsFD(0)

3. get error from valgrind
==19038== Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
==19038==    at 0x7C6D7BD: ??? (in /usr/lib64/libpthread-2.17.so)
==19038==    by 0x547A091: sendfd (passfd.c:86)
==19038==    by 0x53F708C: virNetSocketSendFD (virnetsocket.c:1765)
==19038==    by 0x53EBF70: virNetServerClientDispatchWrite (virnetserverclient.c:1335)
==19038==    by 0x53EBF70: virNetServerClientDispatchEvent (virnetserverclient.c:1435)
==19038==    by 0x52B7B99: virEventPollDispatchHandles (vireventpoll.c:510)
==19038==    by 0x52B7B99: virEventPollRunOnce (vireventpoll.c:660)
==19038==    by 0x52B6281: virEventRunDefaultImpl (virevent.c:308)
==19038==    by 0x15189C: virNetServerRun (virnetserver.c:1139)
==19038==    by 0x11E5B7: main (libvirtd.c:1507)
==19038==  Address 0xffefffc54 is on thread 1's stack
==19038==  in frame #1, created by sendfd (passfd.c:51)

Comment 1 Pavel Hrdina 2015-02-24 10:19:13 UTC
Actually this is a bug in gnulib module that libvirt uses. I've proposed patch to upstream gnulib. After it will be fixed in upstream gnulib, we will use the new gnulib for libvirt to fix this issue.

Comment 2 Eric Blake 2015-02-24 16:02:58 UTC
Gnulib accepted the patch for their side, here's the proposed libvirt patch to pick it up (we missed RC1, so I can't push it without review)
https://www.redhat.com/archives/libvir-list/2015-February/msg00952.html

Comment 3 Eric Blake 2015-02-24 22:18:43 UTC
Fixing this in RHEL 7.2 is easy - the rebase will do the job.  Fixing it in RHEL 7.1 is harder - we prefer not to pick up gnulib updates in maintenance branches.  It's possible with a downstream-only patch, but that violates upstream first, and since the warning is otherwise harmless (we are not actually basing behavior on the uninitialized read, since it occurs in struct padding), it is NOT worth backporting to 7.1.z.

Comment 4 Pavel Hrdina 2015-03-27 10:23:09 UTC
upstream commit:

commit df60346ca2e178de5bcc4dd951d63011883a56d7
Author: Eric Blake <eblake>
Date:   Tue Feb 24 08:58:46 2015 -0700

    maint: update to latest gnulib
    
    Usual update to latest gnulib status.  In particular this update
    fixes at least one issue that can be seen in libvirt, by silencing
    a valgrind detection of uninitialized memory:
    https://bugzilla.redhat.com/show_bug.cgi?id=1174147
    
    * .gnulib: Update to latest.
    * bootstrap: Resync to gnulib.
    
    Signed-off-by: Eric Blake <eblake>

git-describe: v1.2.13-322-gdf60346

Comment 7 Luyao Huang 2015-07-14 03:43:21 UTC
I can reporduce this issue with libvirt-1.2.13-1.el7.x86_64:

# python
Python 2.7.5 (default, Feb 11 2014, 07:46:25) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> con=libvirt.open()
>>> dom=con.lookupByName("test3")
>>> dom.create()
0
>>> dom.openGraphicsFD(0)
4

# valgrind --leak-check=full libvirtd

==17159== Thread 1:
==17159== Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
==17159==    at 0x7E827BD: ??? (in /usr/lib64/libpthread-2.17.so)
==17159==    by 0x54869A1: sendfd (passfd.c:86)
==17159==    by 0x5402591: virNetSocketSendFD (virnetsocket.c:1766)
==17159==    by 0x53F77E0: virNetServerClientDispatchWrite (virnetserverclient.c:1271)
==17159==    by 0x53F77E0: virNetServerClientDispatchEvent (virnetserverclient.c:1371)
==17159==    by 0x52BB8C6: virEventPollDispatchHandles (vireventpoll.c:508)
==17159==    by 0x52BB8C6: virEventPollRunOnce (vireventpoll.c:657)
==17159==    by 0x52B9F91: virEventRunDefaultImpl (virevent.c:308)
==17159==    by 0x1512FC: virNetServerRun (virnetserver.c:1139)
==17159==    by 0x11E34C: main (libvirtd.c:1491)
==17159==  Address 0xffefffb34 is on thread 1's stack
==17159==  in frame #1, created by sendfd (passfd.c:51)
==17159== 

And verify this bug with libvirt-1.2.17-2.el7.x86_64:


# python
Python 2.7.5 (default, Feb 11 2014, 07:46:25) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> con=libvirt.open()
>>> dom=con.lookupByName("test3")
>>> dom.create()
0
>>> dom.openGraphicsFD(0)
7

# valgrind --leak-check=full libvirtd

<no report point to sendfd>



But i noticed another...

==18439== Thread 17:
==18439== Syscall param socketcall.bind(my_addr.sa_data) points to uninitialised byte(s)
==18439==    at 0x833FE97: bind (in /usr/lib64/libc-2.17.so)
==18439==    by 0x1E30C3F5: iface_bind (pcap-linux.c:4743)
==18439==    by 0x1E30C3F5: activate_new (pcap-linux.c:3225)
==18439==    by 0x1E30C3F5: pcap_activate_linux (pcap-linux.c:1293)
==18439==    by 0x1E31283F: pcap_activate (pcap.c:735)
==18439==    by 0x1E313155: pcap_open_live (pcap.c:788)
==18439==    by 0x1E0EEB12: learnIPAddressThread (nwfilter_learnipaddr.c:413)
==18439==    by 0x5506D11: virThreadHelper (virthread.c:206)
==18439==    by 0x8034DF4: start_thread (in /usr/lib64/libpthread-2.17.so)
==18439==    by 0x833F1AC: clone (in /usr/lib64/libc-2.17.so)
==18439==  Address 0x25af09f4 is on thread 17's stack
==18439==  in frame #1, created by pcap_activate_linux (pcap-linux.c:1234)
==18439== 


Seems this still not the libvirt fault.

Comment 8 Luyao Huang 2015-07-14 03:44:22 UTC
Hi Pavel,

Would you please help to check out if comment 7 is okay to verify this bug ? need we open a new bug to against libpcap ?

Thanks in advance for your reply.

Comment 9 Pavel Hrdina 2015-07-14 10:48:18 UTC
Hi Luyao,

Yes, you can verify this bug as fixed and that new issue is in libpcap, so you should create a new bug against that component.

Comment 10 Luyao Huang 2015-07-15 03:09:36 UTC
(In reply to Pavel Hrdina from comment #9)
> Hi Luyao,
> 
> Yes, you can verify this bug as fixed and that new issue is in libpcap, so
> you should create a new bug against that component.

Thanks a lot for your reply, move this bug to verify.

Comment 12 errata-xmlrpc 2015-11-19 05:58:27 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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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