From libssh2-devel-bounces@cool.haxx.se Sat Apr 2 15:16:56 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u32DGTBd000539; Sat, 2 Apr 2016 15:16:53 +0200 Received: from mail-lb0-x233.google.com (mail-lb0-x233.google.com [IPv6:2a00:1450:4010:c04:0:0:0:233]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u32DGTcR000417 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 2 Apr 2016 15:16:29 +0200 Received: by mail-lb0-x233.google.com with SMTP id bc4so97822096lbc.2 for ; Sat, 02 Apr 2016 06:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to; bh=VpMFbYLeL6SPO2xeU1Drp+98u/Sv7zzV1m9+PnemIvE=; b=q16Fy6DOzFPGGP3BMpKQ6l26+BEoYYoA9xoaMqp2JVyGYK+hQULtVA21nP4sfM56y+ /TXJhgbYCF1cNf4u/LJpcxzBwbWs0tHmhi6OI2kshkNHwIMaxf/bRaEpIA0l3YNZCCTD Sbliopcg91ZlXa99hgGDiJDXbGuUROGzwNE+MDU1oVzT/E0r5udoaseR8re4cbwSLAOG zaUi+qYGrYdeSV1MbZu1jxm6hxwHmF6EmxSh/jCOBUd1gC4r/WJJoMG4TtE86SPsZIdJ kBy7zYpfDIKQvYxDLs+nUttm+Rukx7Cq4ZCvKkjMc1moQtjzMYApROjZFxLJ5ngTqPxt hciQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to; bh=VpMFbYLeL6SPO2xeU1Drp+98u/Sv7zzV1m9+PnemIvE=; b=hdcUOdneoChsyEFPKN/JnHGWFnQ3j9OS5SOx9ziaVsQN4UmvBOogXDi4/iyNY6mlGB r4kz/wHUOR9l2ZXYQHckZOOVPQJDJI6vkahtJQD4nwtVxYBl7rV9K3aVgvSm0cts+qNX JS0PpXGHMCYXmM4iT3i/6HgoPZvsCIH/geK9UI+XLZPc/ibDLzlmdKRO0+9r3NQiskOi mBeXuxo9DYRoZkGT8l1Sz96J+19tjvJ7BzH33hqVi01V9IDfjzyWA8p8UeyrKLPCDgYE y/WwRfD6jsKwt1+s17cbNv9MDQN7Cbvsl5Ajlbv/jfczLOWAPdreq0XByrBFrMNirZd7 nOzw== X-Gm-Message-State: AD7BkJLUOfHcaFR+Ah3juytvbEmWPai3LTXXhtBvlEyEr9uma4OJxTGHCxIYpVSdpLHNMfMvdZaL2KpWDDrBAA== MIME-Version: 1.0 X-Received: by 10.28.104.131 with SMTP id d125mr3273066wmc.99.1459602984461; Sat, 02 Apr 2016 06:16:24 -0700 (PDT) Received: by 10.28.5.197 with HTTP; Sat, 2 Apr 2016 06:16:24 -0700 (PDT) In-Reply-To: <1337637350.3855393.1458708455762.JavaMail.yahoo@mail.yahoo.com> References: <2105594000.3326645.1458670229325.JavaMail.yahoo.ref@mail.yahoo.com> <2105594000.3326645.1458670229325.JavaMail.yahoo@mail.yahoo.com> <1337637350.3855393.1458708455762.JavaMail.yahoo@mail.yahoo.com> Date: Sat, 2 Apr 2016 14:16:24 +0100 X-Google-Sender-Auth: -JrwjK0S8kBSqALjUPTG2uvGy8k Message-ID: Subject: Re: libssh2_sftp_init() hangs and does not return while consuming 100% CPU From: Alexander Lamaison To: libssh2 development X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u32DGTBd000539 I'm afraid your emails are being classified as Spam by GMail. I don't have an answer for your question, but I'm replying in case someone else does and hasn't checked their Spam folder. Alex On 23 March 2016 at 04:47, Ismail Aseen wrote: > Hi, > > Adding one more point to the above mail, in the function sftp_packet_read in > sftp.c file, is it a defect to not to address the zero return from > _libssh2_channel_read function in the while loop found in sftp.c:377 ? > > Thanks & Regards, > Ismail Aseen > > > On Tuesday, 22 March 2016, 23:40, Ismail Aseen wrote: > > > Hi, > > I have an application which uses libssh2 to transfer files using SFTP. It > was working well till I had this problem where libssh2_sftp_init() hangs and > does not return while consuming 100% CPU. I did a stack trace using gstack > and got the following stack. Please note that this incident occurred only > once for me and it is not re created again. This incident happened while > communicating with Windows based SFTP server(Tectia). I am using > libssh2-1.6.0. version. Is this a known issue? could anybody assist on this? > > #0 0x00007fd3c719e6ac in recv () from /lib64/libc.so.6 > #1 0x00007fd3c947511b in _libssh2_recv () from > /x01/nptsapp/current/libs/libssh2.so.1 > #2 0x00007fd3c948bc01 in _libssh2_transport_read () from > /x01/nptsapp/current/libs/libssh2.so.1 > #3 0x00007fd3c946cfb1 in _libssh2_channel_read () from > /x01/nptsapp/current/libs/libssh2.so.1 > #4 0x00007fd3c94800fb in sftp_packet_read () from > /x01/nptsapp/current/libs/libssh2.so.1 > #5 0x00007fd3c94806bd in sftp_packet_require () from > /x01/nptsapp/current/libs/libssh2.so.1 > #6 0x00007fd3c9480fd1 in sftp_init () from > /x01/nptsapp/current/libs/libssh2.so.1 > #7 0x00007fd3c9481285 in libssh2_sftp_init () from > /x01/nptsapp/current/libs/libssh2.so.1 > > Thanks, > Ismail Aseen > > > > _______________________________________________ > libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel > -- Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org) _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Sun Apr 3 17:33:24 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u33FWwdh006055; Sun, 3 Apr 2016 17:33:19 +0200 Received: from foo.stuge.se (foo.stuge.se [212.116.89.98]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u33FWup7003172 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 3 Apr 2016 17:32:56 +0200 Received: (qmail 9694 invoked by uid 1000); 3 Apr 2016 15:29:12 -0000 Date: Sun, 3 Apr 2016 15:29:12 +0000 From: Peter Stuge To: libssh2-devel@cool.haxx.se Subject: Re: libssh2_sftp_init() hangs and does not return while consuming 100% CPU Message-ID: <20160403152912.GY26940@foo.stuge.se> References: <2105594000.3326645.1458670229325.JavaMail.yahoo.ref@mail.yahoo.com> <2105594000.3326645.1458670229325.JavaMail.yahoo@mail.yahoo.com> <1337637350.3855393.1458708455762.JavaMail.yahoo@mail.yahoo.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1337637350.3855393.1458708455762.JavaMail.yahoo@mail.yahoo.com> X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u33FWwdh006055 Ismail Aseen wrote: > Adding one more point to the above mail, in the function > sftp_packet_read in sftp.c file, is it a defect to not to address > the zero return from _libssh2_channel_read function  in the while > loop found in sftp.c:377 ? Not neccessarily - it should just mean that the channel has received no data during this call to channel_read. //Peter _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Mon Apr 4 06:43:04 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u344gbYa004598; Mon, 4 Apr 2016 06:42:58 +0200 Received: from nm31-vm8.bullet.mail.bf1.yahoo.com (nm31-vm8.bullet.mail.bf1.yahoo.com [72.30.239.134]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u344gYwp004152 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 4 Apr 2016 06:42:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1459744949; bh=rMWOqEb3uTHm7WW8JJSJjAeBOt0bj3eunFeH5Y577Zs=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=T7sXt0SVp70q48LWZk3CdSZdCHdhiTp5j/PuofEcf0O4BN5+Q83rtcKtFshLyIHU3bBKoiHPjHeLYR0dFBEV6i0RNpgqZ0SkT768g/BSUwPrMiDA407G5+tbfpl8otNh0ohIpjqwJPGX/mYBULBnZBQBuPubsRhkAXeBkdeLkTH3tlhk1vE1GcevezIqLTs+Q5oIt8uO3Jd9jcaerLBiY2gS3O/dDKW0bFGPrJl73KiJSjR0fbRfnrKzSPEBmXUkfkdOuPE9Vota8vsVtLEFJb1O64ae2Ae8e939KTLoAxfjgXQ83rcVJU1JA+fRwMy2OzJQaZAfvlO9ojQaxZncwQ== Received: from [98.139.215.141] by nm31.bullet.mail.bf1.yahoo.com with NNFMP; 04 Apr 2016 04:42:29 -0000 Received: from [98.139.212.221] by tm12.bullet.mail.bf1.yahoo.com with NNFMP; 04 Apr 2016 04:42:29 -0000 Received: from [127.0.0.1] by omp1030.mail.bf1.yahoo.com with NNFMP; 04 Apr 2016 04:42:29 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 931425.89915.bm@omp1030.mail.bf1.yahoo.com X-YMail-OSG: 8EoMwuMVM1lxFpVZXNnu5UsegvrBWJ2wBqp1LH3xoks_BrwGNZ0So9.jTnYV6rF 4tj7mLhNMZuuoOIBZ4ONmrNOYgw_wVye8rvxG4BU039HiASb205Ch1nW1LZlBFY.6JTPpC3vvH_S 3wl4skb9ZAS4JchgWVF8P20XRAM62Ay6EJZIx5JuPyLRMvPqIqDrQO2hfiISwIGo_6Ux1pJ26owC OUQdmaFfeSRgbvKxkXd.SLzFKj4mfo0SRUwe87JEClrtJ.t8.wRp2iUfLYvVCeuMlnNS7OytEjxi PUVqUx4g92qRbH_vbnvMsdo88ZODnNNhNPoKj5V.kIrY0rIB2CCUTG_OlSrnO8_DH.z1CFJoXACo paoN7mIv9lJhgn56dRsYpa3JVo0mnn2OG6UWm4Cq4VyfPghKLIZgtFH.ceAc5ti1DTdd7WVQso.l tu5giTOerUvAeDo7ri9YTLkF85quwourK7tapuYnCcXaYSF85FNI0U8uz4fTZ3Ro.Wd8BAUNd0ON jrgrCKBk7VGQmRvBFeTTcgqpbSqegseJdkbfHtl9GJoeMg2IvGaMzTqOPOh1taGouaCSOtQeecLY _4A-- Received: by 66.196.80.125; Mon, 04 Apr 2016 04:42:29 +0000 Date: Mon, 4 Apr 2016 04:42:29 +0000 (UTC) From: Ismail Aseen To: libssh2 development Message-ID: <923732835.2195089.1459744949230.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <20160403152912.GY26940@foo.stuge.se> References: <20160403152912.GY26940@foo.stuge.se> Subject: Re: libssh2_sftp_init() hangs and does not return while consuming 100% CPU MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Ismail Aseen , libssh2 development Content-Type: multipart/mixed; boundary="===============1684840671==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============1684840671== Content-Type: multipart/alternative; boundary="----=_Part_2195088_1724722181.1459744949228" ------=_Part_2195088_1724722181.1459744949228 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks Alex/Peter to replying to my message.=C2=A0My original problem was o= ne of my thread consuming 100% CPU while initiating a file transfer using l= ibssh2. The stack trace showed it is in recv system call (I thought it is u= nlikely to consume 100 CPU while in a recv call). So I thought some loop sh= ould be calling the same function stack repeatedly to consume the CPU and l= eading to the stack output which I sent on the earlier email. Is there any = possibility that a "channel_read" call returning zero and it is repeatedly = called by sftp_packet_read function in a loop in sftp.c:377. Please excuse = me if I missed a very basic thing which I did not understand. Thanks & Regards,Ismail Aseen =20 On Sunday, 3 April 2016, 21:07, Peter Stuge wrote: =20 Ismail Aseen wrote: > Adding one more point to the above mail, in the function > sftp_packet_read in sftp.c file, is it a defect to not to address > the zero return from _libssh2_channel_read function=C2=A0 in the while > loop found in sftp.c:377 ? Not neccessarily - it should just mean that the channel has received no data during this call to channel_read. //Peter _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel ------=_Part_2195088_1724722181.1459744949228 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks Alex/Peter to replying to my message.
 My original problem was one of my thread cons= uming 100% CPU while initiating a file transfer using libssh2. The stack tr= ace showed it is in recv system call (I thought it is unlikely to consume 1= 00 CPU while in a recv call). So I thought some loop should be calling the = same function stack repeatedly to consume the CPU and leading to the stack = output which I sent on the earlier email. Is there any possibility that a <= /span>"channel_read" call returning zero and it is repeatedly called by sft= p_packet_read function in a loop in sftp.c:377. Please excuse me if I misse= d a very basic thing which I did not understand.

Thanks & Regards,
Ismail Aseen


On Sunday, 3 April 2016, 21:07, Peter Stuge <peter@stuge.s= e> wrote:


Isma= il Aseen wrote:

> Adding one more point to the above mail, in the function
> sftp_packet_read in sftp.c file, is it a defect to not to a= ddress
> the zero return from _libssh2_channel_read fu= nction  in the while
> loop found in sftp.c:377 ?=


Not neccessarily - it should ju= st mean that the channel has received
no data during this= call to channel_read.


//Peter
_____________________________________________= __
libssh2-devel http://cool= .haxx.se/cgi-bin/mailman/listinfo/libssh2-devel



------=_Part_2195088_1724722181.1459744949228-- --===============1684840671== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k ZXZlbCBodHRwOi8vY29vbC5oYXh4LnNlL2NnaS1iaW4vbWFpbG1hbi9saXN0aW5mby9saWJzc2gy LWRldmVsCg== --===============1684840671==-- From libssh2-devel-bounces@cool.haxx.se Mon Apr 4 12:16:01 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u34AFdVN031303; Mon, 4 Apr 2016 12:15:57 +0200 Received: from foo.stuge.se (foo.stuge.se [212.116.89.98]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u34AFaav031072 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 4 Apr 2016 12:15:37 +0200 Received: (qmail 13182 invoked by uid 1000); 4 Apr 2016 10:11:49 -0000 Date: Mon, 4 Apr 2016 10:11:49 +0000 From: Peter Stuge To: libssh2-devel@cool.haxx.se Subject: Re: libssh2_sftp_init() hangs and does not return while consuming 100% CPU Message-ID: <20160404101149.GZ26940@foo.stuge.se> References: <20160403152912.GY26940@foo.stuge.se> <923732835.2195089.1459744949230.JavaMail.yahoo@mail.yahoo.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <923732835.2195089.1459744949230.JavaMail.yahoo@mail.yahoo.com> X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u34AFdVN031303 Ismail Aseen wrote: > My original problem was one of my thread consuming 100% CPU while > initiating a file transfer using libssh2. Do you have a session mutex? libssh2 is not thread safe. //Peter _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Mon Apr 4 21:29:53 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u34JTO2h020572; Mon, 4 Apr 2016 21:29:47 +0200 Received: from nm38-vm1.bullet.mail.bf1.yahoo.com (nm38-vm1.bullet.mail.bf1.yahoo.com [72.30.239.17]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u34JTLoa020487 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 4 Apr 2016 21:29:22 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1459798157; bh=8N4ITBuJ0CqpEcQ2XLgqLiU4s++SiUIFt1E9rouUNrU=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=b4SD9CPS14wnyBdJHCb/So4AFNLbHGvKCALHfoL+LPv5cr4vtlOGfCIfUr7iHgVI2byTCmI3216ApqgVMBgJKQP8IPHukybsY7SWcim3IpJsa/BvRBoXvejEywhFGd1VOT3kul7mcCwcMZvDEk6fJdQSdtVYQr6ZwWaBKq3VIG9lux+busJExi1zI7m/VBLaGTOFMv3cQBWF9QFrBdIpum8VgrNK+sdkAI0M0jwlfyP5a6TGycS0fDualTahogKCrYPdwIQTQ+gv4TME+GMXD8lVOfcWvf7AGUQzUj231AAVhZ5/lQBCWiG+R4DVkiXgmb5gYqewCbv2c91LhAgkxA== Received: from [98.139.170.180] by nm38.bullet.mail.bf1.yahoo.com with NNFMP; 04 Apr 2016 19:29:17 -0000 Received: from [98.139.215.251] by tm23.bullet.mail.bf1.yahoo.com with NNFMP; 04 Apr 2016 19:29:17 -0000 Received: from [127.0.0.1] by omp1064.mail.bf1.yahoo.com with NNFMP; 04 Apr 2016 19:29:17 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 653792.60609.bm@omp1064.mail.bf1.yahoo.com X-YMail-OSG: f1h3OxQVM1n31_eUoq1pWIu7k8TK1BDnK_s89NG.F3acU3_FrrT0xTbLzYSxt1f ltt7.9uYBYXwaqCvliA5JQDPAPaSbSp8OF8J73M963ft5W6Qne6.Tp7T02IQ1.z6nWE.3TceIG93 SDtxVHbf.0GrfwGd4CO5nhKmYxJtCf3E.4exweXE4Qn9ebF_LvDcg3ieizocnGWfQgz_HNSo_FsW 1oWeJnV1lMhd7RsrwQVGIGP2YhIOii6swqw5a9hCduU6DYotxGSiAGGd_gptqEDmYddsO72Kej6y lJxc4WX_B50ESOXxPutOf9aO51eq7iBVW3HyG_whwY0YhWaZdkxl6MOSmeiVk1zAnFSHlVlZaB9B 5jmpsyqHixFlfiMgpH0SdswwQREWzdUyeje2dczwMqbcAr5QtMdl2HszwjSwfA54OsYiKV5X5XW7 3yDjCG5CHj8._tdWTnqDWxMqmrIB_1FsBAlzvYfFouZUGbqh6oa.fCxBjbZhduczqpautcXgElNS OGxSsAASjUtBadqpjQLDnhWHgTBeivkOP5IjMF4jgkEpwiLlJk5eDyKMH7UsgTvyeUF86UjqVSoW icQ-- Received: by 76.13.27.70; Mon, 04 Apr 2016 19:29:17 +0000 Date: Mon, 4 Apr 2016 19:28:39 +0000 (UTC) From: Ismail Aseen To: libssh2 development Message-ID: <1741502599.2742151.1459798119664.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <20160404101149.GZ26940@foo.stuge.se> References: <20160404101149.GZ26940@foo.stuge.se> Subject: Re: libssh2_sftp_init() hangs and does not return while consuming 100% CPU MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Ismail Aseen , libssh2 development Content-Type: multipart/mixed; boundary="===============0127816445==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============0127816445== Content-Type: multipart/alternative; boundary="----=_Part_2742150_963326953.1459798119655" ------=_Part_2742150_963326953.1459798119655 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Peter, My application is a multi threaded one with three threads, I did not implem= ent any special call backs for thread safety.=C2=A0 But I made sure the LIB= SSH2_SESSIONs are not shared between the threads, and also the libssh2_init= is called in sequential manner for all threads (once before separation of = thread life, i.e. in the main thread). I did not use the function call libs= sh2_exit assuming my program is long running process. From my logs I did no= t notice any activity from my other two threads around this time. Is this i= nsufficient to work well in my case?. Please let me know if I have done som= e thing seriously wrong Thanks & Regards,Ismail Aseen =20 On Monday, 4 April 2016, 15:41, Peter Stuge wrote: =20 Ismail Aseen wrote: >=C2=A0My original problem was one of my thread consuming 100% CPU while > initiating a file transfer using libssh2. Do you have a session mutex? libssh2 is not thread safe. //Peter _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel ------=_Part_2742150_963326953.1459798119655 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Peter,

My applicat= ion is a multi threaded one with three threads, I did not implement any spe= cial call backs for thread safety.  But I made sure the LIBSSH2_SESSIO= Ns are not shared between the threads, and also the libssh2_init is called = in sequential manner for all threads (once before separation of thread life= , i.e. in the main thread). I did not use the function call libssh2_exit as= suming my program is long running process. From my logs I did not notice an= y activity from my other two threads around this time. Is this insufficient= to work well in my case?. Please let me know if I have done some thing ser= iously wrong

Thanks & Regards,
Ismail Aseen


=
On Monday, 4 April 2016, = 15:41, Peter Stuge <peter@stuge.se> wrote:


=
Ismail Aseen wrote:
>&= nbsp;My original problem was one of my thread consuming 100% CPU while
> initiating a file transfer using libssh2.

Do you have a session mutex? libssh2 is not thread s= afe.



//Peter
________________= _______________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-deve= l


------=_Part_2742150_963326953.1459798119655-- --===============0127816445== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k ZXZlbCBodHRwOi8vY29vbC5oYXh4LnNlL2NnaS1iaW4vbWFpbG1hbi9saXN0aW5mby9saWJzc2gy LWRldmVsCg== --===============0127816445==-- From libssh2-devel-bounces@cool.haxx.se Wed Apr 6 14:40:47 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u36CeMYA015322; Wed, 6 Apr 2016 14:40:41 +0200 Received: from foo.stuge.se (foo.stuge.se [212.116.89.98]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u36CeKW7015201 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 6 Apr 2016 14:40:21 +0200 Received: (qmail 22679 invoked by uid 1000); 6 Apr 2016 12:36:23 -0000 Date: Wed, 6 Apr 2016 12:36:23 +0000 From: Peter Stuge To: libssh2-devel@cool.haxx.se Subject: Re: libssh2_sftp_init() hangs and does not return while consuming 100% CPU Message-ID: <20160406123623.GD26940@foo.stuge.se> References: <20160404101149.GZ26940@foo.stuge.se> <1741502599.2742151.1459798119664.JavaMail.yahoo@mail.yahoo.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1741502599.2742151.1459798119664.JavaMail.yahoo@mail.yahoo.com> X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u36CeMYA015322 Ismail Aseen wrote: > I made sure the LIBSSH2_SESSIONs are not shared between the threads All right, that's fine. So that's not the problem then. Sorry, don't know what it might be. Try enabling full tracing and investigeate if the libssh2 trace output gives some clues. //Peter _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Wed Apr 6 21:09:13 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u36J8mSU027778; Wed, 6 Apr 2016 21:09:10 +0200 Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06:0:0:0:241]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u36J8jib027680 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 6 Apr 2016 21:08:46 +0200 Received: by mail-io0-x241.google.com with SMTP id s2so8800107iod.3 for ; Wed, 06 Apr 2016 12:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codyps.com; s=google; h=mime-version:date:message-id:subject:from:to :content-transfer-encoding; bh=Y26Dy3xjYcuBTZ+BAAYCdA+I4KaMHmYLOH/2um1tR+c=; b=OT21lwLs9zVyX55blWSpSmD8fpNHRwMiX165jPHjYfUOhfflWaAbx3e0Rox1kkPaia Wdc02m4JGkCz31EVB0c62FISUSdk9wfxVD48mKGeT6MsJ6QB2SM/wlk3oiJ3Jej3nKLZ Go9zxEzEbKK8mAl8ZKLV7Igy1W7EelNKLwgzg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-transfer-encoding; bh=Y26Dy3xjYcuBTZ+BAAYCdA+I4KaMHmYLOH/2um1tR+c=; b=IdNZkDte95C8fVoaBiyOzE+PdRzL94DcejY3tiQ+e3d+FbN0jdCGUBcuy7vMA8ou85 rNVlxaa2lQhpvjS426XMJ6LCiXr0lDowyvaAxe4pJlyt71vStIYmm3RDrcdE8l9RsaCO +qcVNlX0KLuxEK9g3DYWF4sP64L2TDx5sgOSkhiXkKloqqfz33I1ChgjJ+4L0clAop2/ oZJ7zoUzA+RV77ZMQEtULH7RCSjndZhh7t36QNRykw9lQU+qsDba9Qi55qQql7qOVvMW 5tiwQzuGK28RTHCUCPKwN+fh2HVOY50qMeorgJPhbsUg+dD21EsOqY6CvW2NgCAJknF8 HweA== X-Gm-Message-State: AD7BkJKFuvgEivMa6AbZpxLfOGtNSlm0jUZsOHXLKGoE0DPk6/xbmPZ6dVTeJd8qLnO7zKKaeiSsC53gC4ebRA== MIME-Version: 1.0 X-Received: by 10.107.10.87 with SMTP id u84mr29203461ioi.188.1459969721201; Wed, 06 Apr 2016 12:08:41 -0700 (PDT) Received: by 10.36.217.73 with HTTP; Wed, 6 Apr 2016 12:08:41 -0700 (PDT) X-Originating-IP: [96.237.165.28] Date: Wed, 6 Apr 2016 15:08:41 -0400 Message-ID: Subject: dh parameter generation still not quite right? From: Cody P Schafer To: libssh2-devel@cool.haxx.se X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id u36J8jib027680 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u36J8mSU027778 I was looking into CVE-2016-0787 (bits vs bytes confusion within dh exponent generation) and noted that someone had taken a look at the code and commented on the github commit: https://github.com/libssh2/libssh2/commit/ca5222ea819cc5ed797860070b4c6c1aeeb28420 After some examination myself, it appears that diffie_hellman_sha1 is vulnerable to the same issue that diffie_hellman_sha256 was vulnerable to, and there are other issues with private exponent generation that should be examined. I'm including the comments from github below for posterity: yumkam commented on ca5222e on Feb 23: > Something feels eerily wrong here. > 1) compare diffie_hellman_sha1 and diffie_hellman_sha256; is not there exactly same problem in sha1 variant? > 2) if I was not mistaken, this is generation of "private exponent"; but "private exponent" need not be as large as group order! Normal size is "twice as generated key material", something from 256 bits to 512 bits for usual symmetric algos and key sizes, see rfc4419 section 6.2 (Private exponent) [1]. > That is, it was, indeed, about 2 times too small before (and still wrong for diffie_hellman_sha1?), but it is more than 4 times too large now. (Well, at least later is only performance issue). > Disclaimer: I'm not real cryptographer, but only playing one. > P.S. openssh uses min(2*max(symmetric_{key,iv,block,mac}_in_bits),p_bits-1) yumkam commented on ca5222e on Feb 23: > Also, for diffie-hellman-group-exchange-*, if p_bits+1 is not multiply of 8, group_order*8 can be larger than p_bits (by up to 7 bits); thus, generated group_order*8-1-bit random value x can fail 1 < x < (p-1)/2 test, see rfc4419[2] [1]: https://tools.ietf.org/html/rfc4419#section-6.2 [2]: https://tools.ietf.org/html/rfc4419#section-3 Checking the code in git today shows the same flaws noted in those comments still exist. _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Thu Apr 7 05:38:12 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u373bjw2004327; Thu, 7 Apr 2016 05:38:07 +0200 Received: from nm11.bullet.mail.bf1.yahoo.com (nm11.bullet.mail.bf1.yahoo.com [98.139.212.170]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u373bgqO004197 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 7 Apr 2016 05:37:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1460000258; bh=N1M3IgNZqDRzmg4/4Raaj06B4ltaKGiVqq4NGZyzZJk=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=j4nSzOJEwJA6rpZYpFw94EF41l7ErqRFeIMKm1Nw/cxZjwUxAEQkKQuk1DyJL3UnZmXNiy11iwQ2NQqsrAystFbhTc73dQryWVEr9pz7Dfviwb0qZODRzteG42ecJAeaA911Nr8V0/WqydQL6zmgpawXzXLcApACNpV3aEynrCejxV89z9KiXyyQB1jaUfAcFTTlIY05gtrap8SJK/VJrk12Qd6JRxqDI235cIFT0c83X1U0dL4Yp3/Ahpl0kZZ48FUSdDfenmaQpPPewBaw/Cr7zM+cFO5MBTw8UC/aTtarTG1Qr1FE04r8Lgjc+pDQalzm7T/Lyt5sOtV3d1lOEw== Received: from [98.139.215.142] by nm11.bullet.mail.bf1.yahoo.com with NNFMP; 07 Apr 2016 03:37:38 -0000 Received: from [98.139.212.193] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 07 Apr 2016 03:37:38 -0000 Received: from [127.0.0.1] by omp1002.mail.bf1.yahoo.com with NNFMP; 07 Apr 2016 03:37:38 -0000 X-Yahoo-Newman-Property: ymail-5 X-Yahoo-Newman-Id: 318342.53222.bm@omp1002.mail.bf1.yahoo.com X-YMail-OSG: I6vzlw0VM1mjiC_mCzfMwrWWY.FVvDRHWr5FJ8Rw5dzj3h1S6fIp_E73U67LH6Z 5KqgnCWWqyetk3Rtm3WY.jKHz5dvAmMNkebLoOWMK3MEwU9ks83YqBExMRc4DRiDZuMEyrbeji7Y kBT8etrgQmZ2K.BeZ.VtSooorPiSjFNrlts92wNLT4NkJH0dJpX8WDO1.h9vU..L2HJpwVauVcGw iTeB2cuWM7S77AgB7fwBLWRWOjyvXzHa8Lb.Hcza6EoWDV3zueHW7DKHc37hkRZFwoWRIi0fhWJH .qE9B0dT7GQga2m3B5akSOKW.fPh3g8JuTDD7kIOPnDciZ2u4QLyt67bosamnWSmAbst.M1wgMwO fGPDG8CXigWIcPj9sTvc2INKS43uTV1oJgEuiRZ5XBwRXa.TBNK5roMz7LjUUNTzNjX3MAHgiyNJ pY__KOcX5VU8jLIOjQ7SybdEaro59llwruXBElmiCx0svTMR__OWVz9CrCOrhBmGIv4hUgcjbNqs ZUwjPEjBDV4Gxf7ZToExm5ERnJU0Oi32x8mU1_2bu0FtTXY60O79EVBrHKTsJo4B8bvWJwd.GFdd DK9U- Received: by 76.13.26.66; Thu, 07 Apr 2016 03:37:37 +0000 Date: Thu, 7 Apr 2016 03:37:37 +0000 (UTC) From: Ismail Aseen To: libssh2 development Message-ID: <608983188.714781.1460000257533.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <20160406123623.GD26940@foo.stuge.se> References: <20160406123623.GD26940@foo.stuge.se> Subject: Re: libssh2_sftp_init() hangs and does not return while consuming 100% CPU MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Ismail Aseen , libssh2 development Content-Type: multipart/mixed; boundary="===============2122072693==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============2122072693== Content-Type: multipart/alternative; boundary="----=_Part_714780_1310051906.1460000257530" ------=_Part_714780_1310051906.1460000257530 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Peter, Thanks for the update, I will try to re create this using libssh2 trace output enabled. Thanks & Regards,Ismail Aseen On Wednesday, 6 April 2016, 18:14, Peter Stuge wrote: Ismail Aseen wrote: > I made sure the LIBSSH2_SESSIONs are not shared between the threads All right, that's fine. So that's not the problem then. Sorry, don't know what it might be. Try enabling full tracing and investigeate if the libssh2 trace output gives some clues. //Peter _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel ------=_Part_714780_1310051906.1460000257530 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Peter,

Thanks for the update, I will try to re create this using libssh2 t= race output enabled.

Thanks & Regards,
Ismail Aseen


On Wednesday, 6 April 2016, 18:14, Peter Stuge = <peter@stuge.se> wrote:


Ismail Aseen wrote:
> I made sure the LIB= SSH2_SESSIONs are not shared between the threads

All right, that's fine. So that's not the problem then.

Sorry, don't know what it might be. Try enabli= ng full tracing and
investigeate if the libssh2 trace out= put gives some clues.



//Peter
_______________________________________________
libssh2-= devel http://cool.haxx.se/cgi-bin/mailman/list= info/libssh2-devel


------=_Part_714780_1310051906.1460000257530-- --===============2122072693== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k ZXZlbCBodHRwOi8vY29vbC5oYXh4LnNlL2NnaS1iaW4vbWFpbG1hbi9saXN0aW5mby9saWJzc2gy LWRldmVsCg== --===============2122072693==-- From libssh2-devel-bounces@cool.haxx.se Thu Apr 7 10:17:35 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u378HE8a029030; Thu, 7 Apr 2016 10:17:31 +0200 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u378HBID028904 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 7 Apr 2016 10:17:13 +0200 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F28F875759; Thu, 7 Apr 2016 08:17:11 +0000 (UTC) Received: from kdudka.brq.redhat.com (kdudka.brq.redhat.com [10.34.4.67]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u378H8Bg031574 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Apr 2016 04:17:11 -0400 From: Kamil Dudka To: Daniel Stenberg Subject: Re: dh parameter generation still not quite right? Date: Thu, 07 Apr 2016 10:17:08 +0200 Message-ID: <3314181.Xas15gzhIB@kdudka.brq.redhat.com> User-Agent: KMail/4.14.10 (Linux/4.4.6-300.fc23.x86_64; KDE/4.14.18; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Cc: Cody P Schafer , libssh2-devel@cool.haxx.se Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u378HE8a029030 On Wednesday 06 April 2016 15:08:41 Cody P Schafer wrote: > I was looking into CVE-2016-0787 (bits vs bytes confusion within dh > exponent generation) and noted that someone had taken a look at the > code and commented on the github commit: > https://github.com/libssh2/libssh2/commit/ca5222ea819cc5ed797860070b4c6c1aee > b28420 > > After some examination myself, it appears that diffie_hellman_sha1 is > vulnerable to the same issue that diffie_hellman_sha256 was vulnerable > to, and there are other issues with private exponent generation that > should be examined. Yes, this seems to be a known issue: https://www.libssh2.org/mail/libssh2-devel-archive-2016-02/0029.shtml In Fedora we apply the following patch on top of libssh2-1.7.0: http://pkgs.fedoraproject.org/cgit/rpms/libssh2.git/tree/CVE-2016-0787.patch?id=2d448ce0 Daniel, should we apply the patch upstream, too? I know there are some outstanding issues reported in the above thread but they should IMO not prevent this one-liner from being applied as such. Kamil > I'm including the comments from github below for posterity: > > yumkam commented on ca5222e on Feb 23: > > Something feels eerily wrong here. > > 1) compare diffie_hellman_sha1 and diffie_hellman_sha256; is not there > > exactly same problem in sha1 variant? 2) if I was not mistaken, this is > > generation of "private exponent"; but "private exponent" need not be as > > large as group order! Normal size is "twice as generated key material", > > something from 256 bits to 512 bits for usual symmetric algos and key > > sizes, see rfc4419 section 6.2 (Private exponent) [1]. That is, it was, > > indeed, about 2 times too small before (and still wrong for > > diffie_hellman_sha1?), but it is more than 4 times too large now. (Well, > > at least later is only performance issue). Disclaimer: I'm not real > > cryptographer, but only playing one. > > P.S. openssh uses > > min(2*max(symmetric_{key,iv,block,mac}_in_bits),p_bits-1) > > yumkam commented on ca5222e on Feb 23: > > Also, for diffie-hellman-group-exchange-*, if p_bits+1 is not multiply of > > 8, group_order*8 can be larger than p_bits (by up to 7 bits); thus, > > generated group_order*8-1-bit random value x can fail 1 < x < (p-1)/2 > > test, see rfc4419[2] > [1]: https://tools.ietf.org/html/rfc4419#section-6.2 > [2]: https://tools.ietf.org/html/rfc4419#section-3 > > Checking the code in git today shows the same flaws noted in those > comments still exist. > > _______________________________________________ > libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Thu Apr 7 19:07:49 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u37H7PTN009821; Thu, 7 Apr 2016 19:07:44 +0200 Received: from mail.panic.com (mail.panic.com [38.103.165.3]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u37H7LU1009788 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 7 Apr 2016 19:07:23 +0200 Received: from [10.0.0.189] (unknown [38.103.165.36]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.panic.com (Postfix) with ESMTPSA id 1ED3F64CC8; Thu, 7 Apr 2016 10:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=panic.com; s=dkim; t=1460048837; bh=NytBdlLVjabHJwnK93JyQYz80J7+YWgDAGwDG8I0rvA=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=W5ZGv++g00K7iKyDaK1mntxM5BpipcI7YHMnLbiLjDx55uqYY+xLOoBIZpE5NUzyE fsRzWN7e4UZyXG7oA2OrGBYAyAQSikrSwPS9qGrQA+G9PyQqz+AmbOrVqwDPmyDmXE KxkDTvWce8t7HfFU3H2u2pC5qFtKJtB12qm+5sns= Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: dh parameter generation still not quite right? From: Will Cosgrove In-Reply-To: <3314181.Xas15gzhIB@kdudka.brq.redhat.com> Date: Thu, 7 Apr 2016 10:07:16 -0700 Message-Id: References: <3314181.Xas15gzhIB@kdudka.brq.redhat.com> To: libssh2 development , Kamil Dudka X-Mailer: Apple Mail (2.3124) X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id u37H7LU1009788 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Cc: Cody P Schafer , Daniel Stenberg Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u37H7PTN009821 There is an outstanding pull request to resolve this security issue in a different way than the initial commit; unfortunately I’m not well versed enough in the intricacies of DH to conclude if it’s a good patch or not. I did contact Daniel about making the group_order * 8 - 1 change in the SHA1 function the day the security bulletin was posted and he agreed it needed to be done; but apparently no one has actually committed the change. I have submitted a pull request with the original fix ported to the SHA1 method which is identical to the fedora patch. Regards, Will > On Apr 7, 2016, at 1:17 AM, Kamil Dudka wrote: > > On Wednesday 06 April 2016 15:08:41 Cody P Schafer wrote: >> I was looking into CVE-2016-0787 (bits vs bytes confusion within dh >> exponent generation) and noted that someone had taken a look at the >> code and commented on the github commit: >> https://github.com/libssh2/libssh2/commit/ca5222ea819cc5ed797860070b4c6c1aee >> b28420 >> >> After some examination myself, it appears that diffie_hellman_sha1 is >> vulnerable to the same issue that diffie_hellman_sha256 was vulnerable >> to, and there are other issues with private exponent generation that >> should be examined. > > Yes, this seems to be a known issue: > > https://www.libssh2.org/mail/libssh2-devel-archive-2016-02/0029.shtml > > In Fedora we apply the following patch on top of libssh2-1.7.0: > > http://pkgs.fedoraproject.org/cgit/rpms/libssh2.git/tree/CVE-2016-0787.patch?id=2d448ce0 > > Daniel, should we apply the patch upstream, too? > > I know there are some outstanding issues reported in the above thread but > they should IMO not prevent this one-liner from being applied as such. > > Kamil > >> I'm including the comments from github below for posterity: >> >> yumkam commented on ca5222e on Feb 23: >>> Something feels eerily wrong here. >>> 1) compare diffie_hellman_sha1 and diffie_hellman_sha256; is not there >>> exactly same problem in sha1 variant? 2) if I was not mistaken, this is >>> generation of "private exponent"; but "private exponent" need not be as >>> large as group order! Normal size is "twice as generated key material", >>> something from 256 bits to 512 bits for usual symmetric algos and key >>> sizes, see rfc4419 section 6.2 (Private exponent) [1]. That is, it was, >>> indeed, about 2 times too small before (and still wrong for >>> diffie_hellman_sha1?), but it is more than 4 times too large now. (Well, >>> at least later is only performance issue). Disclaimer: I'm not real >>> cryptographer, but only playing one. >>> P.S. openssh uses >>> min(2*max(symmetric_{key,iv,block,mac}_in_bits),p_bits-1) >> >> yumkam commented on ca5222e on Feb 23: >>> Also, for diffie-hellman-group-exchange-*, if p_bits+1 is not multiply of >>> 8, group_order*8 can be larger than p_bits (by up to 7 bits); thus, >>> generated group_order*8-1-bit random value x can fail 1 < x < (p-1)/2 >>> test, see rfc4419[2] >> [1]: https://tools.ietf.org/html/rfc4419#section-6.2 >> [2]: https://tools.ietf.org/html/rfc4419#section-3 >> >> Checking the code in git today shows the same flaws noted in those >> comments still exist. >> >> _______________________________________________ >> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel > > _______________________________________________ > libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Sat Apr 9 00:55:41 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u38MtJVf009874; Sat, 9 Apr 2016 00:55:37 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u38MtI4o009839 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 9 Apr 2016 00:55:18 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.15.2/8.15.2/Submit) with ESMTP id u38MtIiP009832; Sat, 9 Apr 2016 00:55:18 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Sat, 9 Apr 2016 00:55:17 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: dh parameter generation still not quite right? In-Reply-To: <3314181.Xas15gzhIB@kdudka.brq.redhat.com> Message-ID: References: <3314181.Xas15gzhIB@kdudka.brq.redhat.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) X-fromdanielhimself: yes MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Cc: Cody P Schafer Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u38MtJVf009874 On Thu, 7 Apr 2016, Kamil Dudka wrote: > Daniel, should we apply the patch upstream, too? > > I know there are some outstanding issues reported in the above thread but > they should IMO not prevent this one-liner from being applied as such. Yeps, I just merged #103 which was the same change as a pull-request. Thanks. -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Sat Apr 9 11:21:06 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u399KiHF026925; Sat, 9 Apr 2016 11:21:02 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u399Kh1T026906 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 9 Apr 2016 11:20:43 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.15.2/8.15.2/Submit) with ESMTP id u399KhYj026903 for ; Sat, 9 Apr 2016 11:20:43 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Sat, 9 Apr 2016 11:20:42 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: I'm slow Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) X-fromdanielhimself: yes MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u399KiHF026925 Hey, If you think I'm slow and behind on my duties in this project, it is because that is true and it is a legitimate observation. And I don't expect my situtation regarding libssh2 to change much anytime soon. So, I'm hoping others will step up and help out and drive where things need to get done etc. If you review a patch and you like it, say so. If you review a patch and don't like it, say so. Grab an issue and try to reproduce it. Respond in issues and help them get clarified. Open source only works fine when we all join in and do our share. If you think you'd do the project good by getting push rights so that *you* can merge patches and push commits, do say so. But only bother if you've actually been around and shown yourself worthy in the project for a good while first. Thanks! -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Tue Apr 19 11:14:03 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u3J9Dav7001132; Tue, 19 Apr 2016 11:13:57 +0200 Received: from sesbmg22.ericsson.net (sesbmg22.ericsson.net [193.180.251.48]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u3J9DYuK001023 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 19 Apr 2016 11:13:34 +0200 X-AuditID: c1b4fb30-f79d86d0000062a1-ed-5715f6b921bf Received: from ESESSHC002.ericsson.se (Unknown_Domain [153.88.183.24]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 34.AE.25249.9B6F5175; Tue, 19 Apr 2016 11:13:29 +0200 (CEST) Received: from ESESSMB107.ericsson.se ([169.254.7.53]) by ESESSHC002.ericsson.se ([153.88.183.24]) with mapi id 14.03.0248.002; Tue, 19 Apr 2016 11:13:29 +0200 From: Paolo Elefante To: "libssh2-devel@cool.haxx.se" Subject: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment Thread-Topic: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment Thread-Index: AdGaG7rUf8Zgpy79QX2GrertbP1Kgw== Date: Tue, 19 Apr 2016 09:13:28 +0000 Message-ID: <3692BBD5AB72BA41B140F0F6C94C7C152410A34E@ESESSMB107.ericsson.se> Accept-Language: it-IT, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [153.88.183.19] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsUyM2K7hO7Ob6LhBvv3yVksnbuZ1YHR4+KZ 6SwBjFFcNimpOZllqUX6dglcGct/7mIuOBFS8XvSLZYGxhU+XYycHBICJhI35h9gg7DFJC7c Ww9kc3EICRxhlJj6dREThLOYUeLT0d1MIFVsAkYSn/tesILYIgK2En/XLwLrFhaIlFi8+CUj RDxO4vfkeSwQtp7E26/PmEFsFgFVieUfZoHV8wr4SvR3zAWrZxSQlZiwexGYzSwgLnHryXwm iIsEJJbsOc8MYYtKvHz8jxXCVpRof9oAVZ8vMbn3IDPETEGJkzOfsExgFJqFZNQsJGWzkJRB xHUkFuz+xAZha0ssW/iaGcY+c+AxE7L4Akb2VYyixanFSbnpRkZ6qUWZycXF+Xl6eaklmxiB UXFwy2+DHYwvnzseYhTgYFTi4VWYKBouxJpYVlyZe4hRgoNZSYQ34yNQiDclsbIqtSg/vqg0 J7X4EKM0B4uSOG925L8wIYH0xJLU7NTUgtQimCwTB6dUA6PQgrh+rmtSYkvvmNTqWe5ZvvaP b9BZk10H8vtcfu8UqPV2U3q09pjOywvtsww0ljvrZW6Sst7n/f6v5IGEW+zPNPc5+dy6EvCh 51JpypE9c3+6r5kUGBhlc+zyqkc2TO7+iQq3F//ZbM0ixtymxRDF9EVD4RCja3ec8Y9bUxNM tISeWRnERiuxFGckGmoxFxUnAgDsmWFShgIAAA== X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: multipart/mixed; boundary="===============0297542044==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============0297542044== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_3692BBD5AB72BA41B140F0F6C94C7C152410A34EESESSMB107erics_" --_000_3692BBD5AB72BA41B140F0F6C94C7C152410A34EESESSMB107erics_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi there, I use libssh2 (libssh2-1-1.4.3-16.1.x86_64) to establish SFTP connections i= n parallel in my multithreaded application running on Linux SUSE. That code perfectly works on SUSE SLES11, but as I tried to migrate to SLES= 12 I got a serious crash. As the application tries to open an SFTP connection, I get a systematic cra= sh on "CRYPTO_free" when invoking 'libssh2_session_handshake'. I have checked the core dump using symbols and I'm sure that both TCP conne= ction and SSH Session have been established ('libssh2_session_init' is succ= essful). In detail, libssh2_session_handshake crashes while invoking HMAC_Init_ex, E= VP_DigestInit_ex, CRYPTO_free: #0 0x00007fe3600eb0a7 in raise () from /lib64/libc.so.6 #1 0x00007fe3600ec458 in abort () from /lib64/libc.so.6 #2 0x00007fe360128764 in __libc_message () from /lib64/libc.so.6 #3 0x00007fe36012dfce in malloc_printerr () from /lib64/libc.so.6 #4 0x00007fe361e6b3fd in CRYPTO_free () from /lib64/libcrypto.so.1.0.0 #5 0x00007fe361ef4009 in EVP_DigestInit_ex () from /lib64/libcrypto.so.1.0.= 0 #6 0x00007fe361e79360 in HMAC_Init_ex () from /lib64/libcrypto.so.1.0.0 #7 0x00007fe36291ee7a in ?? () from /usr/lib64/libssh2.so.1 #8 0x00007fe36292d3e9 in ?? () from /usr/lib64/libssh2.so.1 #9 0x00007fe362924bd3 in libssh2_session_handshake () from /usr/lib64/libss= h2.so.1 I have initialized OpenSSL for a multithreaded environment using static loc= king callbacks. I have also verified that callbacks are triggered by the un= derlying openssl stratum. I initialized libssh2 using "libssh2_init(0)" I guess there's problem in the setup of my environment, but I can't figure = it out. The same code works on SUSE SLES11 where my application linked libcrypto.so= .0.9.8 and libssl.so.0.9.8, on the contrary on SLES12 my application is lin= king libcrypto.so.1.0.0 and libssl.so.1.0.0. Has anyone experienced this problem or have a suggestion? Thank you so much for your support. Best Regards /Paolo --_000_3692BBD5AB72BA41B140F0F6C94C7C152410A34EESESSMB107erics_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi there,

I use libssh2 (libssh2= -1-1.4.3-16.1.x86_64) to establish SFTP connections in parallel in m= y multithreaded application running on Linux SUSE.

That code perfectly wo= rks on SUSE SLES11, but as I tried to migrate to SLES12 I got a serious cra= sh.

 

As the application tri= es to open an SFTP connection, I get a systematic crash on “CRYPTO_free” when invoking ‘libssh2_session_handshake’.

I have checked the cor= e dump using symbols and I’m sure that both TCP connection and SSH Se= ssion have been established (‘libssh2_session_init’ is successful).

 

In detail, libssh2_ses= sion_handshake crashes while invoking HMAC_Init_ex, EVP_DigestInit_ex, CRYP= TO_free:

#0 0x00007fe3600eb0a7 in raise () from /lib6= 4/libc.so.6

#1 0x00007fe3600ec458 in abort () from /lib6= 4/libc.so.6

#2 0x00007fe360128764 in __libc_message () f= rom /lib64/libc.so.6

#3 0x00007fe36012dfce in malloc_printerr () = from /lib64/libc.so.6

#4 0x00007fe361e6b3fd in CRYPTO_free () from= /lib64/libcrypto.so.1.0.0

#5 0x00007fe361ef4009 in EVP_DigestInit_ex (= ) from /lib64/libcrypto.so.1.0.0

#6 0x00007fe361e79360 in HMAC_Init_ex () fro= m /lib64/libcrypto.so.1.0.0

#7 0x00007fe36291ee7a in ?? () from /usr/lib= 64/libssh2.so.1

#8 0x00007fe36292d3e9 in ?? () from /usr/lib= 64/libssh2.so.1

#9 0x00007fe362924bd3 in libssh2_session_han= dshake () from /usr/lib64/libssh2.so.1

 

I have initialized Ope= nSSL for a multithreaded environment using static locking callbacks. I have= also verified that callbacks are triggered by the underlying openssl strat= um.

I initialized libssh2 = using “libssh2_init(0)

 

I guess there's proble= m in the setup of my environment, but I can’t figure it out.

 

The same code works on= SUSE SLES11 where my application linked libcrypto.so.0.9.8 and libssl.so.0= .9.8, on the contrary on SLES12 my application is linking libcrypto.so.1.0.= 0 and libssl.so.1.0.0.

 

Has anyone experienced= this problem or have a suggestion?

 

Thank you so much for = your support.

 

Best Regards

/Paolo

 

--_000_3692BBD5AB72BA41B140F0F6C94C7C152410A34EESESSMB107erics_-- --===============0297542044== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k ZXZlbCBodHRwOi8vY29vbC5oYXh4LnNlL2NnaS1iaW4vbWFpbG1hbi9saXN0aW5mby9saWJzc2gy LWRldmVsCg== --===============0297542044==-- From libssh2-devel-bounces@cool.haxx.se Tue Apr 19 11:24:21 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u3J9OG6U001982; Tue, 19 Apr 2016 11:24:20 +0200 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u3J9OF5C001978 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 19 Apr 2016 11:24:15 +0200 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CB901AC75 for ; Tue, 19 Apr 2016 09:24:13 +0000 (UTC) Date: Tue, 19 Apr 2016 11:24:15 +0200 (CEST) From: Ales Novak To: libssh2 development Subject: Re: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment In-Reply-To: <3692BBD5AB72BA41B140F0F6C94C7C152410A34E@ESESSMB107.ericsson.se> Message-ID: References: <3692BBD5AB72BA41B140F0F6C94C7C152410A34E@ESESSMB107.ericsson.se> User-Agent: Alpine 2.03 (LSU 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1678391052-27872500-1461057855=:29459" X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1678391052-27872500-1461057855=:29459 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT Hi Paolo, I believe this bug is fixed in the libssh2 PTF which SUSE provided (to Ericsson) last week within the bsc#974691. Can you please try that one? On 2016-4-19 11:13, Paolo Elefante wrote: > > Hi there, > > I use libssh2 (libssh2-1-1.4.3-16.1.x86_64) to establish SFTP connections in parallel in my multithreaded application running on Linux SUSE. > > That code perfectly works on SUSE SLES11, but as I tried to migrate to SLES12 I got a serious crash. > >   > > As the application tries to open an SFTP connection, I get a systematic crash on “CRYPTO_free” when invoking ‘libssh2_session_handshake’. > > I have checked the core dump using symbols and I’m sure that both TCP connection and SSH Session have been established (‘libssh2_session_init’ is successful). > >   > > In detail, libssh2_session_handshake crashes while invoking HMAC_Init_ex, EVP_DigestInit_ex, CRYPTO_free: > > #0 0x00007fe3600eb0a7 in raise () from /lib64/libc.so.6 > > #1 0x00007fe3600ec458 in abort () from /lib64/libc.so.6 > > #2 0x00007fe360128764 in __libc_message () from /lib64/libc.so.6 > > #3 0x00007fe36012dfce in malloc_printerr () from /lib64/libc.so.6 > > #4 0x00007fe361e6b3fd in CRYPTO_free () from /lib64/libcrypto.so.1.0.0 > > #5 0x00007fe361ef4009 in EVP_DigestInit_ex () from /lib64/libcrypto.so.1.0.0 > > #6 0x00007fe361e79360 in HMAC_Init_ex () from /lib64/libcrypto.so.1.0.0 > > #7 0x00007fe36291ee7a in ?? () from /usr/lib64/libssh2.so.1 > > #8 0x00007fe36292d3e9 in ?? () from /usr/lib64/libssh2.so.1 > > #9 0x00007fe362924bd3 in libssh2_session_handshake () from /usr/lib64/libssh2.so.1 > >   > > I have initialized OpenSSL for a multithreaded environment using static locking callbacks. I have also verified that callbacks are triggered by the underlying > openssl stratum. > > I initialized libssh2 using “libssh2_init(0)” > >   > > I guess there's problem in the setup of my environment, but I can’t figure it out. > >   > > The same code works on SUSE SLES11 where my application linked libcrypto.so.0.9.8 and libssl.so.0.9.8, on the contrary on SLES12 my application is linking > libcrypto.so.1.0.0 and libssl.so.1.0.0. > >   > > Has anyone experienced this problem or have a suggestion? > >   > > Thank you so much for your support. > >   > > Best Regards > > /Paolo > >   > > > -- Ales Novak --1678391052-27872500-1461057855=:29459 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k ZXZlbCBodHRwOi8vY29vbC5oYXh4LnNlL2NnaS1iaW4vbWFpbG1hbi9saXN0aW5mby9saWJzc2gy LWRldmVsCg== --1678391052-27872500-1461057855=:29459-- From libssh2-devel-bounces@cool.haxx.se Tue Apr 19 17:44:42 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u3JFiLAD029000; Tue, 19 Apr 2016 17:44:38 +0200 Received: from sesbmg23.ericsson.net (sesbmg23.ericsson.net [193.180.251.37]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u3JFiH43028928 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 19 Apr 2016 17:44:18 +0200 X-AuditID: c1b4fb25-f79f26d00000327e-12-5716524d3d08 Received: from ESESSHC023.ericsson.se (Unknown_Domain [153.88.183.87]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id 07.21.12926.D4256175; Tue, 19 Apr 2016 17:44:13 +0200 (CEST) Received: from ESESSMB107.ericsson.se ([169.254.7.53]) by ESESSHC023.ericsson.se ([153.88.183.87]) with mapi id 14.03.0248.002; Tue, 19 Apr 2016 17:43:44 +0200 From: Paolo Elefante To: libssh2 development Subject: RE: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment Thread-Topic: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment Thread-Index: AdGaG7rUf8Zgpy79QX2GrertbP1Kg///4X6A//94OqA= Date: Tue, 19 Apr 2016 15:43:43 +0000 Message-ID: <3692BBD5AB72BA41B140F0F6C94C7C152410A58F@ESESSMB107.ericsson.se> References: <3692BBD5AB72BA41B140F0F6C94C7C152410A34E@ESESSMB107.ericsson.se> In-Reply-To: Accept-Language: it-IT, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [153.88.183.16] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRmVeSWpSXmKPExsUyM2J7uK5vkFi4wbkp2hZL525mdWD0uHhm OksAYxSXTUpqTmZZapG+XQJXxstNz9kKnqhXfJrTx9LA+ECti5GDQ0LARGJlc3UXIyeQKSZx 4d56ti5GLg4hgSOMEnNW72UFSQgJLGaUuP7DAcRmEzCS+Nz3AiwuAtS7c9cvRhBbWCBW4vGO s4wQ8TiJ35PnsUDYVhIbTy5jB7FZBFQlzk5fDGbzCvhKTJm1lRlifq3E54XnwOKcQPU7d11k A7EZBWQlJuxeBDaTWUBc4taT+UwQhwpILNlznhnCFpV4+fgfK4StKLHzbDszyF/MApoS63fp Q7QqSkzpfgi1VlDi5MwnLBMYRWchmToLoWMWko5ZSDoWMLKsYhQtTi1Oyk03MtZLLcpMLi7O z9PLSy3ZxAiMhoNbfqvuYLz8xvEQowAHoxIPr8JE0XAh1sSy4srcQ4wSHMxKIrzl/mLhQrwp iZVVqUX58UWlOanFhxilOViUxHmzI/+FCQmkJ5akZqemFqQWwWSZODilGhh5z5r+PP9EdtfD PP9Fsg+1/sqbLOdXMPeVsWrc9tjq8Da/L48sZeN+Lai4rZvZveNVh+SCvsKbBya8WxUcO1dL M+PEvGTulrPOKjyizy6dNgh6u/aTxjxe8dAYs3cp593yV/V+s7k6ecmnSdt5Pc5ulXqy+1RI dsQtLZalMj+fnO00fHr5s8w0JZbijERDLeai4kQA0ti9wIICAAA= X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u3JFiH43028928 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u3JFiLAD029000 Hello Ales, Thank you so much for your support! I installed the rpm suggested by you (libssh2-1-1.4.3-16.1.10575.2.PTF.974691.x86_64) and verified that my application works perfectly :-) I see that the bug I have experienced is described here http://trac.libssh2.org/ticket/279 and it has been fixed also in the Version 1.5.0 where it is highlighted in the change log as "openssl: initialize the digest context before calling EVP_DigestInit()" I only have one more doubt and question at the moment. I'm wondering if this bug fix is responsible for the random crash fixed in the 1.6.0. In the change log https://www.libssh2.org/changes.html I see that libssh2 version 1.6.0 contains a fix for: "openssl.c: fix possible segfault in case EVP_DigestInit fails". Are those problems related each other? Do you know if the libssh2 PTF bsc#974691 also contains the bugfix "openssl.c: fix possible segfault in case EVP_DigestInit fails" ? Best Regards /Paolo -----Original Message----- From: libssh2-devel [mailto:libssh2-devel-bounces@cool.haxx.se] On Behalf Of Ales Novak Sent: martedì 19 aprile 2016 11:24 To: libssh2 development Subject: Re: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment Hi Paolo, I believe this bug is fixed in the libssh2 PTF which SUSE provided (to Ericsson) last week within the bsc#974691. Can you please try that one? On 2016-4-19 11:13, Paolo Elefante wrote: > > Hi there, > > I use libssh2 (libssh2-1-1.4.3-16.1.x86_64) to establish SFTP connections in parallel in my multithreaded application running on Linux SUSE. > > That code perfectly works on SUSE SLES11, but as I tried to migrate to SLES12 I got a serious crash. > >   > > As the application tries to open an SFTP connection, I get a systematic crash on “CRYPTO_free” when invoking ‘libssh2_session_handshake’. > > I have checked the core dump using symbols and I’m sure that both TCP connection and SSH Session have been established (‘libssh2_session_init’ is successful). > >   > > In detail, libssh2_session_handshake crashes while invoking HMAC_Init_ex, EVP_DigestInit_ex, CRYPTO_free: > > #0 0x00007fe3600eb0a7 in raise () from /lib64/libc.so.6 > > #1 0x00007fe3600ec458 in abort () from /lib64/libc.so.6 > > #2 0x00007fe360128764 in __libc_message () from /lib64/libc.so.6 > > #3 0x00007fe36012dfce in malloc_printerr () from /lib64/libc.so.6 > > #4 0x00007fe361e6b3fd in CRYPTO_free () from /lib64/libcrypto.so.1.0.0 > > #5 0x00007fe361ef4009 in EVP_DigestInit_ex () from > /lib64/libcrypto.so.1.0.0 > > #6 0x00007fe361e79360 in HMAC_Init_ex () from > /lib64/libcrypto.so.1.0.0 > > #7 0x00007fe36291ee7a in ?? () from /usr/lib64/libssh2.so.1 > > #8 0x00007fe36292d3e9 in ?? () from /usr/lib64/libssh2.so.1 > > #9 0x00007fe362924bd3 in libssh2_session_handshake () from > /usr/lib64/libssh2.so.1 > >   > > I have initialized OpenSSL for a multithreaded environment using > static locking callbacks. I have also verified that callbacks are triggered by the underlying openssl stratum. > > I initialized libssh2 using “libssh2_init(0)” > >   > > I guess there's problem in the setup of my environment, but I can’t figure it out. > >   > > The same code works on SUSE SLES11 where my application linked > libcrypto.so.0.9.8 and libssl.so.0.9.8, on the contrary on SLES12 my > application is linking > libcrypto.so.1.0.0 and libssl.so.1.0.0. > >   > > Has anyone experienced this problem or have a suggestion? > >   > > Thank you so much for your support. > >   > > Best Regards > > /Paolo > >   > > > -- Ales Novak _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Tue Apr 19 17:56:10 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u3JFu5rw012108; Tue, 19 Apr 2016 17:56:09 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTPS id u3JFu3wJ012029 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 19 Apr 2016 17:56:03 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.15.2/8.15.2/Submit) with ESMTP id u3JFu3QU012026 for ; Tue, 19 Apr 2016 17:56:03 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Tue, 19 Apr 2016 17:56:03 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: RE: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment In-Reply-To: <3692BBD5AB72BA41B140F0F6C94C7C152410A58F@ESESSMB107.ericsson.se> Message-ID: References: <3692BBD5AB72BA41B140F0F6C94C7C152410A34E@ESESSMB107.ericsson.se> <3692BBD5AB72BA41B140F0F6C94C7C152410A58F@ESESSMB107.ericsson.se> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) X-fromdanielhimself: yes MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id u3JFu5rw012108 On Tue, 19 Apr 2016, Paolo Elefante wrote: > I see that the bug I have experienced is described here > http://trac.libssh2.org/ticket/279 and it has been fixed also in the Version > 1.5.0 where it is highlighted in the change log as "openssl: initialize the > digest context before calling EVP_DigestInit()" commit 61df22c4601 > I only have one more doubt and question at the moment. I'm wondering if this > bug fix is responsible for the random crash fixed in the 1.6.0. In the > change log https://www.libssh2.org/changes.html I see that libssh2 version > 1.6.0 contains a fix for: "openssl.c: fix possible segfault in case > EVP_DigestInit fails". commit 84590bc78f19 > Are those problems related each other? Yes, they both fix similar problems. -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Tue Apr 26 19:47:22 2016 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u3QHkn6E018190; Tue, 26 Apr 2016 19:47:14 +0200 Received: from COL004-OMC3S3.hotmail.com (col004-omc3s3.hotmail.com [65.55.34.141]) by giant.haxx.se (8.15.2/8.15.2/Debian-3) with ESMTP id u3QHklVR018132 for ; Tue, 26 Apr 2016 19:46:47 +0200 Received: from NAM03-BY2-obe.outbound.protection.outlook.com ([65.55.34.135]) by COL004-OMC3S3.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 26 Apr 2016 10:46:37 -0700 Received: from CO1NAM03FT020.eop-NAM03.prod.protection.outlook.com (10.152.80.56) by CO1NAM03HT106.eop-NAM03.prod.protection.outlook.com (10.152.81.73) with Microsoft SMTP Server (TLS) id 15.1.485.4; Tue, 26 Apr 2016 17:46:35 +0000 Received: from SN1PR15MB0237.namprd15.prod.outlook.com (10.152.80.53) by CO1NAM03FT020.mail.protection.outlook.com (10.152.80.178) with Microsoft SMTP Server (TLS) id 15.1.485.4 via Frontend Transport; Tue, 26 Apr 2016 17:46:35 +0000 Received: from SN1PR15MB0237.namprd15.prod.outlook.com ([10.162.106.155]) by SN1PR15MB0237.namprd15.prod.outlook.com ([10.162.106.155]) with mapi id 15.01.0466.025; Tue, 26 Apr 2016 17:46:35 +0000 From: John Petkovsek To: "libssh2-devel@cool.haxx.se" Subject: libssh2_sftp_write failed: (-9) would block Thread-Topic: libssh2_sftp_write failed: (-9) would block Thread-Index: AQHRn+N0yFLjmx7RS026HSmRGZWgmA== Date: Tue, 26 Apr 2016 17:46:35 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=softfail (sender IP is 25.152.80.53) smtp.mailfrom=hotmail.com; cool.haxx.se; dkim=none (message not signed) header.d=none;cool.haxx.se; dmarc=fail action=none header.from=hotmail.com; received-spf: SoftFail (protection.outlook.com: domain of transitioning hotmail.com discourages use of 25.152.80.53 as permitted sender) x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [vxX0LT9qX8wWm9YC/cBWeCPgV5oVVWfn] x-eopattributedmessage: 0 x-forefront-antispam-report: CIP:25.152.80.53; IPV:NLI; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10019020)(98900003); DIR:OUT; SFP:1102; SCL:1; SRVR:CO1NAM03HT106; H:SN1PR15MB0237.namprd15.prod.outlook.com; FPR:; SPF:SoftFail; MLV:ovrnspm; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: 6f62b387-369a-4ff1-094b-08d36dfab5fc x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(5061506196)(5061507196); SRVR:CO1NAM03HT106; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(432015012)(82015046); SRVR:CO1NAM03HT106; BCL:0; PCL:0; RULEID:; SRVR:CO1NAM03HT106; x-forefront-prvs: 0924C6A0D5 MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2016 17:46:35.0410 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM03HT106 X-OriginalArrivalTime: 26 Apr 2016 17:46:37.0019 (UTC) FILETIME=[949D62B0:01D19FE3] X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.20 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: multipart/mixed; boundary="===============2063653978==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============2063653978== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_SN1PR15MB0237510B8A3B2592722AAEA4CB630SN1PR15MB0237namp_" --_000_SN1PR15MB0237510B8A3B2592722AAEA4CB630SN1PR15MB0237namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I set the session to block with a timeout of 15 seconds but libssh2_sftp_wr= ite returns with a -9 (LIBSSH2_ERROR_TIMEOUT) after just a second or two. --_000_SN1PR15MB0237510B8A3B2592722AAEA4CB630SN1PR15MB0237namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

I set the session to block with a timeout of 15 seconds but libssh2_sftp= _write returns with a -9 (LIBSSH2_ERROR_TIMEOUT) after just a second o= r two.

--_000_SN1PR15MB0237510B8A3B2592722AAEA4CB630SN1PR15MB0237namp_-- --===============2063653978== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k ZXZlbCBodHRwOi8vY29vbC5oYXh4LnNlL2NnaS1iaW4vbWFpbG1hbi9saXN0aW5mby9saWJzc2gy LWRldmVsCg== --===============2063653978==--