Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cen59-0002s4-BV for pgsql-odbc@arkaria.postgresql.org; Fri, 17 Feb 2017 18:16:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cen58-0007Hg-Ua for pgsql-odbc@arkaria.postgresql.org; Fri, 17 Feb 2017 18:16:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cejHL-0003CS-8X for pgsql-odbc@postgresql.org; Fri, 17 Feb 2017 14:12:55 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cejHH-0006Wl-N1 for pgsql-odbc@postgresql.org; Fri, 17 Feb 2017 14:12:53 +0000 Received: by mail-wm0-x229.google.com with SMTP id v77so11043420wmv.0 for ; Fri, 17 Feb 2017 06:12:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denodo-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to; bh=azy3iI2kh0HQEQftPxUf88+V+RGt4yvrpKREBgc4VmI=; b=gdUo7p7OtqX4rFk5O53vWVRdngXaKO8aYTnlpYcbQCIiLCDn9fEY0p+Xio9XJrmVR3 YEkRW5vq2OPjPl+QP29pT39wD2I+ibjhp6ufkhb72v4f7hHiNNJab3NBOQZY8XMkUkVl bZExW1wPgoxuJ+oXPX9OzT0hw9mYKP/TRP+urPCKYQ852JLwPyTesFoLDkSXwkARX357 lpWvXGaLJUf5P7mTVnuqZYmfRFTvIuawtaHsjXGmFZkX0ThMFOXjHzJHwHGQwrMZL6C4 JkWVKjwvH7MsRsXn/z5ZXzVNubBcVxkoe4BkGtceDjjl/Sae5sYciT4Oj6X/0vTtQbl1 HCpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=azy3iI2kh0HQEQftPxUf88+V+RGt4yvrpKREBgc4VmI=; b=cd7WNWuXpecz/5ElURtKPHAIb+Ibn50lfDgcERKs5LRJWm5rRpxRebXOyWJDhUSPLE hWDKVBG4IHqktvcLO/npUwToGmfa+g2aaSWRtj9HQP3PZeK3I4FiIIxnnn09/N4Ji80y P/ieOe1g4BVs3Bz8hbFh8/dHGMCuMj8aL50Ap/qUoucBtv9Ptyi/8OsRV2BgI98QN2Sj 1Q/QPj7pqyz6W9RQHoAnTrRcyk8mrffw2KUBERpaEbphNUbBviBky9mDpy2EaxoNHvqT d3WiSgXAjnpcpvPeLlY2rjjq3pKKTJ59JEgakFXXuzgF9Jr5qaSdquzb0RNIHuUDq6Yh 39hQ== X-Gm-Message-State: AMke39lOkvCvvoFZpY+4GZpHl6iy2EP4fTvhaWkvfqJbV75OxrqBS3MpH3VIxd7g/jQ+VFbFUBQmA7siLh/GZwL+ZayY3+/lG4owUAl5aWGFX/bfuXMBaKILxwXkB/hV5voMw0COF3nU9PFL/pVIv4wZNe96pHN3bfXa/WzxM2s3u3PFtgtu3ZXCzg== X-Received: by 10.28.99.69 with SMTP id x66mr3739764wmb.91.1487340768841; Fri, 17 Feb 2017 06:12:48 -0800 (PST) Received: from [192.168.0.38] (90.136.116.91.static.reverse-mundo-r.com. [91.116.136.90]) by smtp.gmail.com with ESMTPSA id r19sm13091054wrr.44.2017.02.17.06.12.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Feb 2017 06:12:47 -0800 (PST) Subject: Re: Informatica and SSL connections To: "Inoue, Hiroshi" References: <56d70599-a90f-3af3-3d1b-82f8ffb75c1c@dream.email.ne.jp> <89e84f06-3141-e93b-098b-71ef182e25ae@dream.email.ne.jp> <38bd12e3-4cd6-1284-7a3b-b63053a14df3@denodo.com> <0a756f2d-afd8-8a7a-58ef-804dbaab0aa7@denodo.com> Cc: pgsql-odbc@postgresql.org From: =?UTF-8?Q?Jacobo_S=c3=a1nchez?= Message-ID: <04ab2769-5fff-17a6-924f-b17f6f907439@denodo.com> Date: Fri, 17 Feb 2017 15:12:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <0a756f2d-afd8-8a7a-58ef-804dbaab0aa7@denodo.com> Content-Type: multipart/alternative; boundary="------------A9B98E238BEE8428871B761D" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multi-part message in MIME format. --------------A9B98E238BEE8428871B761D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi again Ok when i said that i have tried to replace the libraries i was doing it in the wrong place (not the crashing client but the server). Just let you know that copying the libeay32 and ssleay32 from the ODBC driver and replacing the ones in the Informatica client seems to resolve the issue. So i suspect that something like (https://github.com/droe/sslsplit/issues/16) was happening and openssl libraries from Informatica somehow corrupted data structures used inside libpq... leading to the crash while freeing the ssl connection. Just writing this to let you know or for anybody with a similar behavior. Regards! Jacobo On 16-Feb-17 14:25, Jacobo Sánchez wrote: > > Hi > > I think so.At least it includes libeay and ssleay dlls (which i > tried to replace with the ones from the driver). > > I managed to narrow it down to libpq in fe-secure-openssl.c in > pgtls_close. > > With the mentioned heidiSQL fields in conn->ssl struct seems to be > messed up with invalid values so it is not the same issue than > Informatica. > > The call to openssl crashing Informatica is > > SSL_free(conn->ssl); > > dont know why currently. Just printed some conn->ssl struct fields > (ssl->type, ssl->version, ssl->quiet_shutdown, ssl->shutdown, > ssl->references) but still did not found anything suspicious. I will > try to figure out at least when it will fail in order to prevent the > call then. > > Thanks for your replys BTW! > > Regards > > Jacobo > > > > El 16/02/17 a las 13:30, Inoue, Hiroshi escribió: >> Hi, >> >> Does informatica itself use SSL communications? >> >> regards, >> Hiroshi Inoue >> >> On 2017/02/16 18:50, Jacobo Sánchez wrote: >>> >>> Hi again >>> >>> I could somehow install a similar environment in my machine and >>> new version also crashes when using SSL. However from what i have >>> found from google it points more to an issue with libpq (interacting >>> with some other libraries maybe). I could avoid the issue by not >>> calling PQFinish() in method SOCK_Destructor of socket.c from >>> version 09.03.400 but im not sure which kind of problems/leaks this >>> may raise, do you have any idea of how bad may be this workaround? >>> >>> I could also reproduce the error by installing 32 bit version of >>> heidiSQL (following the error described in >>> http://www.heidisql.com/forum.php?t=15646) and it also crashes >>> calling PQFinish() method (by calling directly libpq and not using >>> ODBC). >>> >>> There is also an old (2005) thread in the postgres mailing list >>> that seems related but im not really sure >>> http://postgresql.nabble.com/BUG-2246-Bad-malloc-interactions-ecpg-openssl-td2119930.html >>> >>> All i found points more to libpq than to the driver itself. >>> However seems to be a tricky thing and i have not an isolated test >>> case without using external clients :( >>> >>> Regards >>> Jacobo >>> >>> >>> El 14/02/17 a las 12:21, Inoue, Hiroshi escribió: >>>> Hi, >>>> >>>> On 2017/02/14 17:34, Jacobo Sánchez wrote: >>>>> >>>>> Hello >>>>> >>>>> >>>>> Im currently looking for a test environment under my control >>>>> in order to check this or any other solution. Is there any >>>>> specific change that may lead to think that this could be already >>>>> fixed in 09.06.100? >>>> >>>> After 09.05.0100 the driver uses libpq fully, whereas the driver >>>> used libpq partially before. >>>> >>>> regards, >>>> Hiroshi Inoue >>>> >>>>> That may give me a chance to speed up things by asking for testing >>>>> it in a real environment. >>>>> >>>>> Thanks for your response, I will notify the results with >>>>> 09.06.100 when tested. >>>>> >>>>> Regards >>>>> >>>>> Jacobo >>>>> >>>>> >>>>> El 14/02/17 a las 03:26, Inoue, Hiroshi escribió: >>>>>> Hi Jacobo, >>>>>> >>>>>> On 2017/02/14 1:06, Jacobo Sánchez wrote: >>>>>>> >>>>>>> Hello all >>>>>>> >>>>>>> >>>>>>> Im facing an issue using the ODBC driver from Informatica which >>>>>>> may be resumed in the following (im using 09.03.400): >>>>>> >>>>>> Could you try the latest version 09.06.0100? >>>>>> >>>>>> regards, >>>>>> Hiroshi Inoue >>>>>> >>>>>>> https://kb.informatica.com/solution/23/Pages/52/320564.aspx >>>>>>> >>>>>>> If someone does not want to open the URL the failing trace is as >>>>>>> follows: >>>>>>> >>>>>>> Crashing Thread is as follows: >>>>>>> >>>>>>> ntdll!RtlFreeHeap+132 >>>>>>> msvcrt!free+1c >>>>>>> libeay32!CRYPTO_free+2e >>>>>>> libeay32!ASN1_STRING_free+27 >>>>>>> libeay32!ASN1_primitive_free+ac >>>>>>> libeay32!ASN1_template_free+128 >>>>>>> libeay32!ASN1_template_free+9b >>>>>>> libeay32!ASN1_item_free+1e9 >>>>>>> libeay32!X509_free+1a >>>>>>> libpq!PQinitSSL+105c >>>>>>> libpq!PQinitSSL+1113 >>>>>>> libpq!PQencryptPassword+7cf >>>>>>> libpq!PQfinish+12 >>>>>>> psqlodbc35w!ConfigDriver+1b7e >>>>>>> psqlodbc35w!Ordinal93+4162 >>>>>>> psqlodbc35w!Ordinal93+3285 >>>>>>> psqlodbc35w!SQLDisconnect+5f >>>>>>> odbc32!SQLDisconnect+2ae >>>>>>> pmodbc!TODBCDb::Disconnect+7f >>>>>>> pmodlnt!TDatabase::Disconnect+3c >>>>>>> pmrelrdr!relReader::fetch+54be >>>>>>> pmservnt!readerSource::operator=+307f >>>>>>> pmservnt!DTMMain+219e8 >>>>>>> pmservnt!Writer::Writer+632b >>>>>>> pmservnt!SSeqGenHandler::operator=+2897 >>>>>>> pmservnt!isForeignKey+6dd >>>>>>> pmcef!SThread::init+293 >>>>>>> kernel32!BaseThreadInitThunk+d >>>>>>> ntdll!RtlUserThreadStart+1d >>>>>>> >>>>>>> >>>>>>> ODBC Trace is as follows: >>>>>>> >>>>>>> _dss_000PQZ0I0 19d8-256c ENTER SQLFreeStmt >>>>>>> HSTMT 0x0000000005C2D030 >>>>>>> UWORD 1 >>>>>>> >>>>>>> s_dss_000PQZ0I0 19d8-256c EXIT SQLFreeStmt with return code >>>>>>> 0 (SQL_SUCCESS) >>>>>>> HSTMT 0x0000000005C2D030 >>>>>>> UWORD 1 >>>>>>> >>>>>>> s_dss_000PQZ0I0 19d8-256c ENTER SQLTransact >>>>>>> HENV 0x0000000000000000 >>>>>>> HDBC 0x0000000005C25560 >>>>>>> UWORD 0 >>>>>>> >>>>>>> s_dss_000PQZ0I0 19d8-256c EXIT SQLTransact with return code >>>>>>> 0 (SQL_SUCCESS) >>>>>>> HENV 0x0000000000000000 >>>>>>> HDBC 0x0000000005C25560 >>>>>>> UWORD 0 >>>>>>> >>>>>>> s_dss_000PQZ0I0 19d8-256c ENTER SQLDisconnect >>>>>>> HDBC 0x0000000005C25560​ >>>>>>> >>>>>>> I am searching for the root of the issue in order to prevent it >>>>>>> from happening but i am not really sure if the problem comes >>>>>>> from libpq or the driver itself. As far as i understand this is >>>>>>> a segmentation fault by trying to free a malloc that has been >>>>>>> already freed, however im not sure if the problem comes from >>>>>>> PQfinish of the driver calling it when it shouldn't. >>>>>>> >>>>>>> Anyone can point me to where the issue comes from? >>>>>>> >>>>>>> Regards, Jacobo >>>>>>> >>>>>> >>>>> >>>> >>> >> > --------------A9B98E238BEE8428871B761D Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hi again

  Ok when i said that i have tried to replace the libraries i was doing it in the wrong place (not the crashing client but the server).

  Just let you know that copying the libeay32 and ssleay32 from the ODBC driver and replacing the ones in the Informatica client seems to resolve the issue. So i suspect that something like (https://github.com/droe/sslsplit/issues/16) was happening and openssl libraries from Informatica somehow corrupted data structures used inside libpq... leading to the crash while freeing the ssl connection.

  Just writing this to let you know or for anybody with a similar behavior.

  Regards!

Jacobo


On 16-Feb-17 14:25, Jacobo Sánchez wrote:

Hi

    I think so.At least it includes libeay and ssleay dlls (which i tried to replace with the ones from the driver).

    I managed to narrow it down to libpq in fe-secure-openssl.c in pgtls_close.

    With the mentioned heidiSQL fields in conn->ssl struct seems to be messed up with invalid values so it is not the same issue than Informatica.

    The call to openssl crashing Informatica is

        SSL_free(conn->ssl);

    dont know why currently. Just printed some conn->ssl struct fields (ssl->type, ssl->version, ssl->quiet_shutdown, ssl->shutdown, ssl->references) but still did  not found anything suspicious. I will try to figure out at least when it will fail in order to prevent the call then.

    Thanks for your replys BTW!

Regards

Jacobo



El 16/02/17 a las 13:30, Inoue, Hiroshi escribió:
Hi,

Does informatica itself use SSL communications?

regards,
Hiroshi Inoue

On 2017/02/16 18:50, Jacobo Sánchez wrote:

Hi again

    I could somehow install a similar environment in my machine and new version also crashes when using SSL. However from what i have found from google it points more to an issue with libpq (interacting with some other libraries maybe). I could avoid the issue by not calling PQFinish() in method SOCK_Destructor of socket.c from version 09.03.400 but im not sure which kind of problems/leaks this may raise, do you have any idea of how bad may be this workaround?

    I could also reproduce the error by installing 32 bit version of heidiSQL (following the error described in http://www.heidisql.com/forum.php?t=15646) and it also crashes calling PQFinish() method (by calling directly libpq and not using ODBC).

    There is also an old (2005) thread in the postgres mailing list that seems related but im not really sure http://postgresql.nabble.com/BUG-2246-Bad-malloc-interactions-ecpg-openssl-td2119930.html

    All i found points more to libpq than to the driver itself. However seems to be a tricky thing and i have not an isolated test case without using external clients :(

Regards
Jacobo
   

El 14/02/17 a las 12:21, Inoue, Hiroshi escribió:
Hi,

On 2017/02/14 17:34, Jacobo Sánchez wrote:

Hello


    Im currently looking for a test environment under my control in order to check this or any other solution. Is there any specific change that may lead to think that this could be already fixed in 09.06.100?

After 09.05.0100 the driver uses libpq fully, whereas the driver used libpq partially before.

regards,
Hiroshi Inoue

That may give me a chance to speed up things by asking for testing it in a real environment.

    Thanks for your response, I will notify the results with 09.06.100 when tested.

Regards

Jacobo


El 14/02/17 a las 03:26, Inoue, Hiroshi escribió:
Hi Jacobo,

On 2017/02/14 1:06, Jacobo Sánchez wrote:

Hello all


Im facing an issue using the ODBC driver from Informatica which may be resumed in the following (im using 09.03.400):

Could you try the latest version 09.06.0100?

regards,
Hiroshi Inoue

https://kb.informatica.com/solution/23/Pages/52/320564.aspx

If someone does not want to open the URL the failing trace is as follows:

Crashing Thread is as follows:

ntdll!RtlFreeHeap+132 
msvcrt!free+1c 
libeay32!CRYPTO_free+2e 
libeay32!ASN1_STRING_free+27 
libeay32!ASN1_primitive_free+ac 
libeay32!ASN1_template_free+128 
libeay32!ASN1_template_free+9b 
libeay32!ASN1_item_free+1e9 
libeay32!X509_free+1a 
libpq!PQinitSSL+105c 
libpq!PQinitSSL+1113 
libpq!PQencryptPassword+7cf 
libpq!PQfinish+12 
psqlodbc35w!ConfigDriver+1b7e 
psqlodbc35w!Ordinal93+4162 
psqlodbc35w!Ordinal93+3285 
psqlodbc35w!SQLDisconnect+5f 
odbc32!SQLDisconnect+2ae 
pmodbc!TODBCDb::Disconnect+7f 
pmodlnt!TDatabase::Disconnect+3c 
pmrelrdr!relReader::fetch+54be 
pmservnt!readerSource::operator=+307f 
pmservnt!DTMMain+219e8 
pmservnt!Writer::Writer+632b 
pmservnt!SSeqGenHandler::operator=+2897 
pmservnt!isForeignKey+6dd 
pmcef!SThread::init+293 
kernel32!BaseThreadInitThunk+d 
ntdll!RtlUserThreadStart+1d 


ODBC Trace is as follows:
_dss_000PQZ0I0 19d8-256c ENTER SQLFreeStmt 
HSTMT 0x0000000005C2D030 
UWORD 1 <SQL_DROP> 

s_dss_000PQZ0I0 19d8-256c EXIT SQLFreeStmt with return code 0 (SQL_SUCCESS) 
HSTMT 0x0000000005C2D030 
UWORD 1 <SQL_DROP> 

s_dss_000PQZ0I0 19d8-256c ENTER SQLTransact 
HENV 0x0000000000000000 
HDBC 0x0000000005C25560 
UWORD 0 <SQL_COMMIT> 

s_dss_000PQZ0I0 19d8-256c EXIT SQLTransact with return code 0 (SQL_SUCCESS) 
HENV 0x0000000000000000 
HDBC 0x0000000005C25560 
UWORD 0 <SQL_COMMIT> 

s_dss_000PQZ0I0 19d8-256c ENTER SQLDisconnect 
HDBC 0x0000000005C25560​

I am searching for the root of the issue in order to prevent it from happening but i am not really sure if the problem comes from libpq or the driver itself. As far as i understand this is a segmentation fault by trying to free a malloc that has been already freed, however im not sure if the problem comes from PQfinish of the driver calling it when it shouldn't.

Anyone can point me to where the issue comes from?

Regards, Jacobo








--------------A9B98E238BEE8428871B761D--