Bug 1379005

Summary: gssproxy memory leak (localname) in gp_export_creds_linux in src/gp_export.c
Product: Red Hat Enterprise Linux 7 Reporter: Thomas Gardner <thgardne>
Component: gssproxyAssignee: Robbie Harwood <rharwood>
Status: CLOSED ERRATA QA Contact: Abhijeet Kasurde <akasurde>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: akasurde, dpal, fs-qe, ipa-qe, nsoman, rharwood, yoyang
Target Milestone: rc   
Target Release: 7.4   
Hardware: All   
OS: Linux   
URL: https://pagure.io/gssproxy/pull-request/33
Whiteboard:
Fixed In Version: gssproxy-0.6.2-4.el7 Doc Type: Bug Fix
Doc Text:
Fixed several memory leaks in gssproxy. (Group 1379005, 1379482, 1379616, 1380490 together as a single line item.)
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 20:55:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1298243, 1399979    

Description Thomas Gardner 2016-09-23 21:58:19 UTC
Description of problem:

localname is a local struct variable which contains a pointer and an integer (containing the size of whatever is in the block pointed to by the pointer).  We end up (through a series of calls) allocating memory for that pointer, but never freeing it before the struct containing the pointer to it just disappears ('cause it's a local function) when the function returns.  Here's the valgrind output:

==24113== 37,104 bytes in 4,638 blocks are definitely lost in loss record 76 of 85
==24113==    at 0x4C29BFD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==24113==    by 0x65F4F7D: UnknownInlinedFun (gssapi_alloc.h:99)
==24113==    by 0x65F4F7D: gssalloc_strdup (gssapi_alloc.h:120)
==24113==    by 0x65F4F7D: krb5_gss_localname (gssapi_krb5.c:768)
==24113==    by 0x65EE4E5: gss_localname (gssd_pname_to_uid.c:173)
==24113==    by 0x40D043: gp_export_creds_linux (gp_export.c:757)
==24113==    by 0x40D043: gp_export_creds_to_gssx_options (gp_export.c:876)
==24113==    by 0x40DEC7: gp_accept_sec_context (gp_rpc_accept_sec_context.c:165)
==24113==    by 0x40ADC0: gp_rpc_execute (gp_rpc_process.c:343)
==24113==    by 0x40ADC0: gp_rpc_process_call (gp_rpc_process.c:400)
==24113==    by 0x4073CB: gp_handle_query (gp_workers.c:447)
==24113==    by 0x4073CB: gp_worker_main (gp_workers.c:401)
==24113==    by 0x6822DC4: start_thread (pthread_create.c:308)
==24113==    by 0x6B2DCEC: clone (clone.S:113)


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

The customer's version is 0.4.1-8.el7_2, but I just downloaded the latest version from brew, and it sure looks like that version has the same bug.

How reproducible:

Customer can easily reproduce it, but it doesn't matter, I found the bug.

Steps to Reproduce:
1.
2.
3.

Actual results:

Memory leaks.

Expected results:

Memory not to leak.

Additional info:

Comment 7 Abhijeet Kasurde 2017-05-22 14:03:49 UTC
Verified using GSSProxy :: gssproxy-0.7.0-3.el7.x86_64

Marking BZ as verified as sanityonly.

Comment 8 errata-xmlrpc 2017-08-01 20:55:26 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://access.redhat.com/errata/RHBA-2017:2033