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 1008619 - libvirtd leaks memory in virSystemdEscapeName on domain startup
Summary: libvirtd leaks memory in virSystemdEscapeName on domain startup
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-16 17:23 UTC by Ján Tomko
Modified: 2014-06-18 00:56 UTC (History)
3 users (show)

Fixed In Version: libvirt-1.1.1-6.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 10:25:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ján Tomko 2013-09-16 17:23:46 UTC
Description of problem:
When starting a domain, libvirtd leaks memory in virSystemdEscapeName

Version-Release number of selected component (if applicable):
libvirt-1.1.1-4.el7

How reproducible:
100 %

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

2. create a domain
virsh create /dev/stdin <<EOF
> <domain type='qemu'>
>   <name>duck</name>
>   <memory unit='MiB'>32</memory>
>   <os>
>     <type arch='x86_64' machine='pc'>hvm</type>
>   </os>
> </domain>
> EOF
Domain duck created from /dev/stdin

Actual results:

valgrind shows a leak in virSystemdEscapeName:
==21660== 1,003 bytes in 1 blocks are definitely lost in loss record 712 of 750
==21660==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21660==    by 0x4A08278: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21660==    by 0x508462F: virReallocN (viralloc.c:233)
==21660==    by 0x5086BA3: virBufferGrow (virbuffer.c:129)
==21660==    by 0x5086D71: virBufferAdd (virbuffer.c:165)
==21660==    by 0x5086DB7: virBufferAddChar (virbuffer.c:185)
==21660==    by 0x50C6B26: virSystemdEscapeName (virsystemd.c:67)
==21660==    by 0x50C6D22: virSystemdMakeSliceName (virsystemd.c:108)
==21660==    by 0x50C6ED1: virSystemdCreateMachine (virsystemd.c:165)
==21660==    by 0x508AFBD: virCgroupNewMachine (vircgroup.c:1708)
==21660==    by 0x1BA19201: qemuSetupCgroup (qemu_cgroup.c:667)
==21660==    by 0x1BA3045F: qemuProcessStart (qemu_process.c:3831)


Expected results:
virSystemdEscapeName doesn't leak

Additional info:
Upstream patch posted: https://www.redhat.com/archives/libvir-list/2013-September/msg00856.html

Comment 1 Ján Tomko 2013-09-16 17:32:45 UTC
Now pushed upstream:
commit 09b48562aac12387a5ff9ac2f27f9a60490f41ee
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-09-16 15:27:42 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-09-16 19:26:21 +0200

    Free slicename in virSystemdCreateMachine
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1008619
    
    1,003 bytes in 1 blocks are definitely lost in loss record 599 of 635
    ==404== by 0x50728A7: virBufferAddChar (virbuffer.c:185)
    ==404== by 0x50BC466: virSystemdEscapeName (virsystemd.c:67)
    ==404== by 0x50BC6B2: virSystemdMakeSliceName (virsystemd.c:108)
    ==404== by 0x50BC870: virSystemdCreateMachine (virsystemd.c:169)
    ==404== by 0x5078267: virCgroupNewMachine (vircgroup.c:1498)

git describe: v1.1.2-129-g09b4856 

Downstream patch posted:
http://post-office.corp.redhat.com/archives/rhvirt-patches/2013-September/msg00496.html

Comment 3 Hao Liu 2013-09-22 10:08:33 UTC
This fix is VERIFIED:

Following steps in https://bugzilla.redhat.com/show_bug.cgi?id=1008619#c0

leak in virSystemdEscapeName can be reproduced in
libvirt-1.1.1-4.el7
and disappeared (among other leaks) in
libvirt-1.1.1-6.el7

Comment 4 Ludek Smid 2014-06-13 10:25:47 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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