Re: BUG #2246: Bad malloc interactions: ecpg, openssl

From: Andrew Klosterman <andrew5(at)ece(dot)cmu(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Date: 2006-02-15 20:14:59
Message-ID: Pine.LNX.4.53L-ECE.CMU.EDU.0602151504410.31548@blossom.pdl.cmu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

On Wed, 15 Feb 2006, Tom Lane wrote:

> Andrew Klosterman <andrew5(at)ece(dot)cmu(dot)edu> writes:
> > With the debug binaries, I was able to step through the program and get to
> > what appears to be the function where it bails: line 1166 of
> > postgresql-8.1.0/src/interfaces/libpq/fe-secure.c where SSL_free() is
> > called.
>
> BTW, is the address that glibc says is corrupted consistent from run to
> run? If so, you could narrow down the problem pretty quickly by setting
> a hardware watchpoint on that address with gdb. Any hits that are not
> from the malloc subroutines are probably the source of the problem.
>
> regards, tom lane

The address given by the error message is consistent. But, setting a
break/watch point for it has been troublesome.

A watchpoint can't be set until the memory is mapped in. I have narrowed
down the time that the memory is mapped in to being somewhere in a call to
PQconnectPoll() from within connectDBComplete() in
src/interfaces/libpq/fe-connect.c. With the watchpoint set, though, the
debugger isn't breaking the execution of the program until the error
manifests itself.

Digging around, I can't come up with a way to get information on the
arguments and return results from malloc() every time it is called.
"strace" only does system calls. The output I get from "ltrace" is not
useful and no options I can see appear to improve the situation.

So, I'm kinda stuck. This bug might be one that gets away...

--Andrew J. Klosterman
andrew5(at)ece(dot)cmu(dot)edu

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-02-15 20:23:38 Re: BUG #2246: Only call pg_fe_getauthname if none given
Previous Message Stephen Frost 2006-02-15 20:05:26 Re: BUG #2246: Only call pg_fe_getauthname if none given

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-02-15 20:23:38 Re: BUG #2246: Only call pg_fe_getauthname if none given
Previous Message Stephen Frost 2006-02-15 20:05:26 Re: BUG #2246: Only call pg_fe_getauthname if none given