kadmind memory leaks in recent MIT krb code

Will Fiveash William.Fiveash at sun.com
Wed Jun 25 17:12:48 EDT 2008


While testing my mkey keytab changes I discovered that kadmind was
leaking memory.  My branch is based on revision 20367 of the trunk.

The leaks fall into one of the following:

            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
         81b2da0          81b09c8    8e11e41922dd9                1
                          8178a90          80c35dc                0
                 libumem.so.1`umem_cache_alloc_debug+0x14f
                 libumem.so.1`umem_cache_alloc+0x144
                 libumem.so.1`umem_alloc+0xc5
                 libumem.so.1`malloc+0x27
                 libc.so.1`strdup+0x28
                 libkrb5support.so.0.1`krb5int_get_error+0x190
                 libkrb5.so.3.3`krb5_get_error_message+0x28
                 get_policy_2_svc+0x1b4
                 kadm_1+0x615
                 libgssrpc.so.4.0`gssrpc_svc_getreqset+0x2a0
                 kadm_svc_run+0xe5
                 main+0xd27
                 _start+0x80

It looks like there are a number of places calling
krb5_get_error_message() that are not freeing the returned error string.

=============================================================================

            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
         818e718          818b640    8e2eb8f39eb39                1
                          8178390          80cbed8                0
                 libumem.so.1`umem_cache_alloc_debug+0x14f
                 libumem.so.1`umem_cache_alloc+0x144
                 libumem.so.1`umem_alloc+0xc5
                 libumem.so.1`malloc+0x27
                 libgssapi_krb5.so.2.2`gss_add_cred+0x23b
                 libgssapi_krb5.so.2.2`gss_acquire_cred+0x11e
                 libgssrpc.so.4.0`gssrpc__svcauth_gss+0x47f
                 libgssrpc.so.4.0`gssrpc__authenticate+0x8d
                 libgssrpc.so.4.0`gssrpc_svc_getreqset+0x132
                 kadm_svc_run+0xe5
                 main+0xd27
                 _start+0x80

Not sure what the exact cause is as malloc() is called in several places
in gss_add_cred().

========================================================================
The overall stats look like:

CACHE     LEAKED   BUFCTL CALLER
08178a90    2140 081b2da0 libc.so.1`strdup+0x28
08178a90     710 08202978 libc.so.1`strdup+0x28
0817b010     710 081b3718 libc.so.1`strdup+0x28
0817b010     709 081b7900 libc.so.1`strdup+0x28
0817b390    6497 081aa948 libgssapi_krb5.so.2.2`gss_acquire_cred+0xb7
08178390    6497 0818e718 libgssapi_krb5.so.2.2`gss_add_cred+0x23b
08178390    6497 0818e6a0 libgssapi_krb5.so.2.2`gss_add_cred+0x253
08178710    6497 08193b68 libgssapi_krb5.so.2.2`gss_add_cred+0x2e0
08178390       2 08d58230 libgssrpc.so.4.0`gssrpc__svcauth_gss+0x98
0817c010       2 081d0b10 libgssrpc.so.4.0`gssrpc__svcauth_gss+0xb1
08178710       1 08196ec0 libkrb5.so.3.3`krb5_ktfile_resolve+0x1c
------------------------------------------------------------------------
   Total   30262 buffers, 823864 bytes

Are these leaks known or should I open bugs?

-- 
Will Fiveash
Sun Microsystems Inc.
http://opensolaris.org/os/project/kerberos/



More information about the krbdev mailing list