Memory leakage in libpq valgrind test

Started by Sudheer H Rabout 3 years ago4 messagesbugs
Jump to latest
#1Sudheer H R
sudheer.hr@tekenlight.com

Hello,

I am using libpq (version 5.12) for connecting to Postgresql 12.8.

While running valgrind to detect memory leaks, found the following as one of the leaks.
Request you to comment on this.

Regards,
Sudheer

==4938== 153 (48 direct, 105 indirect) bytes in 1 blocks are definitely lost in loss record 30 of 42
==4938== at 0x4849D8C: malloc (in /usr/lib/aarch64-linux-gnu/valgrind/vgpreload_memcheck-arm64-linux.so)
==4938== by 0xB31173B: krb5int_setspecific (in /usr/lib/aarch64-linux-gnu/libkrb5support.so.0.1)
==4938== by 0xB13AA5B: ??? (in /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2.2)
==4938== by 0xB13AB33: ??? (in /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2.2)
==4938== by 0xB13AC73: ??? (in /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2.2)
==4938== by 0xB1395D7: ??? (in /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2.2)
==4938== by 0xB13A18B: ??? (in /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2.2)
==4938== by 0xB1290EB: gss_add_cred_from (in /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2.2)
==4938== by 0xB129577: gss_acquire_cred_from (in /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2.2)
==4938== by 0xB129787: gss_acquire_cred (in /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2.2)
==4938== by 0xB0E00DF: ??? (in /usr/lib/aarch64-linux-gnu/libpq.so.5.12)
==4938== by 0xB0CC1D3: PQconnectPoll (in /usr/lib/aarch64-linux-gnu/libpq.so.5.12)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sudheer H R (#1)
Re: Memory leakage in libpq valgrind test

Sudheer H R <sudheer.hr@tekenlight.com> writes:

While running valgrind to detect memory leaks, found the following as one of the leaks.
Request you to comment on this.

So ... why do you think this is our bug, and not a Kerberos bug?
The leak seems to be buried quite far in libgssapi_krb5.so.

regards, tom lane

#3Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#2)
Re: Memory leakage in libpq valgrind test

On Wed, Mar 01, 2023 at 01:43:50AM -0500, Tom Lane wrote:

So ... why do you think this is our bug, and not a Kerberos bug?
The leak seems to be buried quite far in libgssapi_krb5.so.

Yeah, libpq calls gss_acquire_cred(). So, assuming that the leak is
localized within one of the resources allocated by this call, there is
nothing in the kerberos docs that point to a routine to free it:
https://web.mit.edu/kerberos/krb5-latest/doc/appdev/gssapi.html or
gssapi.rst in its code tree.

I may be missing something, of course.
--
Michael

#4Sudheer H R
sudheer.hr@tekenlight.com
In reply to: Michael Paquier (#3)
Re: Memory leakage in libpq valgrind test

OK….

I am looking for links where I can raise an issue with libgssapi_krb5 team.
Would any of you know an appropriate link to raise the issue.

I am doing the test on ubuntu linux and on aarch64 (ARM 64)

Sudheer

Show quoted text

On 01-Mar-2023, at 12:29 PM, Michael Paquier <michael@paquier.xyz> wrote:

On Wed, Mar 01, 2023 at 01:43:50AM -0500, Tom Lane wrote:

So ... why do you think this is our bug, and not a Kerberos bug?
The leak seems to be buried quite far in libgssapi_krb5.so.

Yeah, libpq calls gss_acquire_cred(). So, assuming that the leak is
localized within one of the resources allocated by this call, there is
nothing in the kerberos docs that point to a routine to free it:
https://web.mit.edu/kerberos/krb5-latest/doc/appdev/gssapi.html or
gssapi.rst in its code tree.

I may be missing something, of course.
--
Michael