Bug 918572 - Memory leak in setsockcreatecon (rawhide only)
Summary: Memory leak in setsockcreatecon (rawhide only)
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: libselinux
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-06 14:25 UTC by Richard W.M. Jones
Modified: 2015-01-19 13:02 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-19 13:02:59 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
test.c (812 bytes, text/plain)
2013-03-06 14:25 UTC, Richard W.M. Jones
no flags Details

Description Richard W.M. Jones 2013-03-06 14:25:46 UTC
Created attachment 706000 [details]
test.c

Description of problem:

Testing with valgrind shows a memory leak in setsockcreatecon
in libselinux in Rawhide.  It only occurs when you call
setsockcreatecon (some_context) followed later in the same
program by calling setsockcreatecon (NULL).

The attached test program demonstrates the problem.

==11843== 56 bytes in 1 blocks are definitely lost in loss record 6 of 6
==11843==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==11843==    by 0x38EAC861F9: strdup (strdup.c:42)
==11843==    by 0x38EC8097C9: setprocattrcon_raw.constprop.3 (procattr.c:241)
==11843==    by 0x38EC8099B7: setprocattrcon.constprop.2 (procattr.c:274)
==11843==    by 0x400955: main (in /tmp/test)

This seems to be a regression compared to Fedora 18.

Version-Release number of selected component (if applicable):

libselinux-2.1.13-6.fc19.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Download the attached test program.
2. gcc -Wall test.c -o test -lselinux
3. valgrind --leak-check=full ./test

Also try removing the second call to setsockcreatecon (NULL).  The
memory leak goes away.

Also try running the same test on Fedora 18 with
libselinux-2.1.12-7.1.fc18.x86_64.  There is no memory leak
in this version.

Comment 1 Daniel Walsh 2013-03-06 17:19:39 UTC
Fixed in  libselinux-2.1.13-7.el7

Nice catch.

Comment 2 Fedora End Of Life 2013-04-03 20:25:19 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 3 Fedora End Of Life 2015-01-09 22:32:04 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Richard W.M. Jones 2015-01-19 13:02:59 UTC
Since we have libselinux 2.3 in Fedora 21, I think we can close this.


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