[php-maint] Bug#411982: more information

sean finney seanius at debian.org
Fri Mar 23 00:52:41 UTC 2007


it seems that the problem is between curl and libpq, and the bystanders
in php seem to be innocent victims.  

from libpq's be-secure.c:

/*
 *      Close SSL connection.
 */
static void
close_SSL(Port *port)
{
        if (port->ssl)
        {
                SSL_shutdown(port->ssl);
                SSL_free(port->ssl);


from curl's ssluse.c:


/* Global cleanup */
void Curl_ossl_cleanup(void)
{
  /* Free the SSL error strings */
  ERR_free_strings();


from php's backtrace:

(gdb) bt
#0  0x00002b71ee8889a0 in ?? ()
#1  0x00002b71edf446df in int_err_del () at err.c:353
#2  0x00002b71ee4e9ef9 in Curl_ossl_cleanup ()
at ../../../lib/ssluse.c:580
#3  0x00002b71ee4f93e2 in Curl_ssl_cleanup ()
at ../../../lib/sslgen.c:185
#4  0x00002b71ee4f2233 in curl_global_cleanup ()
at ../../../lib/easy.c:294
#5  0x00002b71ee3a3699 in zm_shutdown_curl (type=9, module_number=1)
    at /tmp/buildd/php5-5.2.0/ext/curl/interface.c:668
...


in the case that no postgres server is running the libpq SSL_free() is
never called, and no segfault happens.  from the manpage for SSL_free():

 SSL_free() also calls the free()ing procedures for indirectly affected
 items, if applicable: the buffering BIO, the read and write BIOs,
 cipher lists specially created for this ssl, the SSL_SESSION.  Do not
 explicitly free these indirectly freed up items before or after calling
 SSL_free(), as trying to free things twice may lead to program failure.

i'm not sure if the error strings cound as "indirectly freed up items"
or not, but it seems to be part of the problem anyway.  i'll bring this
to a wider audience tomorrow to see if someone who knows more about
sharing libssl between multiple libraries has anything to say.



	sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-php-maint/attachments/20070323/899a2c70/attachment.pgp


More information about the pkg-php-maint mailing list