From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aLdwM+pmSl9xCgAA0tVLHw (envelope-from ) for ; Sat, 29 Aug 2020 14:32:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id IM4eL+pmSl8cGAAAbx9fmQ (envelope-from ) for ; Sat, 29 Aug 2020 14:32:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1A1AE9404D2 for ; Sat, 29 Aug 2020 14:32:10 +0000 (UTC) Received: from localhost ([::1]:48102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kC1tp-0001tO-1u for larch@yhetil.org; Sat, 29 Aug 2020 10:32:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kC1th-0001t6-TQ for bug-guix@gnu.org; Sat, 29 Aug 2020 10:32:01 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37289) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kC1th-00089k-KZ for bug-guix@gnu.org; Sat, 29 Aug 2020 10:32:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kC1th-00018o-IU; Sat, 29 Aug 2020 10:32:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#42740: Segfault in libssh during =?UTF-8?Q?=E2=80=98guix_?= =?UTF-8?Q?copy=E2=80=99?= Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 29 Aug 2020 14:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42740 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Artyom Poptsov Received: via spool by 42740-submit@debbugs.gnu.org id=B42740.15987114894344 (code B ref 42740); Sat, 29 Aug 2020 14:32:01 +0000 Received: (at 42740) by debbugs.gnu.org; 29 Aug 2020 14:31:29 +0000 Received: from localhost ([127.0.0.1]:48835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kC1tB-00017z-7Y for submit@debbugs.gnu.org; Sat, 29 Aug 2020 10:31:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kC1tA-00017n-H7 for 42740@debbugs.gnu.org; Sat, 29 Aug 2020 10:31:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54080) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kC1t5-00087Q-6Q; Sat, 29 Aug 2020 10:31:23 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35042 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kC1t4-0002vR-Pn; Sat, 29 Aug 2020 10:31:22 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <871rkin6zi.fsf@inria.fr> <874kollgst.fsf@gnu.org> Date: Sat, 29 Aug 2020 16:31:20 +0200 In-Reply-To: <874kollgst.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 29 Aug 2020 15:31:30 +0200") Message-ID: <87h7sljzgn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxim Cournoyer , 42740@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: 4b1NL06i5Lp1 Ludovic Court=C3=A8s skribis: > So we have the finalization thread closing a channel of session > 0x12a4b20 (which causes a write on the channel), and the main thread > writing to a channel of that same session. This is exactly what I > described at : > > AIUI, that means there=E2=80=99s one output compression buffer per sess= ion, > and it=E2=80=99s not thread-safe (in Guile 2.2 finalizers are called fr= om a > separate thread.) > > I think the fix, in Guile-SSH, is to associate each libssh object > (session, channel, etc.) with a mutex, and to protect all uses of the > libssh object by that mutex. > > Artyom, WDYT? Do you think you could take a look into that? > > In the meantime, I=E2=80=99ll look for the origin of the channel port tha= t=E2=80=99s not > explicitly closed and see if we can work around it. I=E2=80=99ve pushed this change on our side to explicitly close channels and sessions: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D61fe9ced7da7eefce= b931af0cb7363b721f5bdd6 This workaround is similar to that of 2017: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D8e469b67f95cfe5b9= 5405b503b8ee315fdf8ce66 It=E2=80=99s really just a workaround so I think we should fix the core iss= ue in Guile-SSH (or libssh) so it doesn=E2=80=99t pop up again next month=E2=80= =94it=E2=80=99s hard to ensure code that opens a channel explicitly closes it. Anyway, I would welcome tests using =E2=80=98guix copy=E2=80=99, =E2=80=98g= uix deploy=E2=80=99, and offloading. (For offloading, make sure to run the daemon from your build tree.) Ludo=E2=80=99.