Bug 684015

Summary: unchecked return value of getpwuid() in policycoreutils-rhat.patch
Product: Red Hat Enterprise Linux 6 Reporter: Kamil Dudka <kdudka>
Component: policycoreutilsAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact:
Priority: high    
Version: 6.1CC: dwalsh, ksrot, mmalik, msvoboda
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: policycoreutils-2.0.83-19.19.el6 Doc Type: Bug Fix
Doc Text:
The missing exit(1) function call in the underlying code of the sepolgen-ifgen utility could cause the restorecond daemon to access already freed memory when retrieving user's information. This would cause restorecond to terminate unexpectedly with a segmentation fault. With this update, restorecond has been modified to check the return value of the getpwuid() function to avoid this situation.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 15:10:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 750385, 756082, 787579    

Description Kamil Dudka 2011-03-10 22:00:27 UTC
Description of problem:
Return value of getpwuid() should be checked before dereferencing.


Version-Release number of selected component (if applicable):
policycoreutils-2.0.83-19.1.el6


Additional info:
Missing call of exit(1) in sepolgen-ifgen-attr-helper.c may cause a double free:

    /* Open the output policy. */
    fp = fopen(argv[2], "w");
    if (fp == NULL) {
        fprintf(stderr, "error opening output file\n");
        policydb_destroy(p);
        free(p);
    }

    ...

    policydb_destroy(p);
    free(p);
    fclose(fp);

Comment 3 RHEL Program Management 2011-03-10 22:17:53 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 4 Daniel Walsh 2011-03-15 16:18:23 UTC
Fixed in policycoreutils-2.0.83-33.3.fc13

Comment 5 Daniel Walsh 2011-03-15 16:24:40 UTC
Fixed in policycoreutils-2.0.83-33.3.el6

Comment 10 Daniel Walsh 2012-01-25 22:24:18 UTC
Fixed in policycoreutils-2.0.83-19.19.el6

Comment 14 Miroslav Svoboda 2012-02-14 17:50:40 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The missing exit(1) function call in the underlying code of the sepolgen-ifgen utility could cause the restorecond daemon to access already freed memory when retrieving user's information. This would cause restorecond to terminate unexpectedly with a segmentation fault. With this update, restorecond has been modified to check the return value of the getpwuid() function to avoid this situation.

Comment 17 errata-xmlrpc 2012-06-20 15:10:24 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-2012-0969.html