From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id gE8jEu3ubGOQPgAAbAwnHQ (envelope-from ) for ; Thu, 10 Nov 2022 13:30:37 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id yKxWEe3ubGM1BgEAG6o9tA (envelope-from ) for ; Thu, 10 Nov 2022 13:30:37 +0100 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 E59762FC54 for ; Thu, 10 Nov 2022 13:30:36 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot6hC-0005jf-Iv; Thu, 10 Nov 2022 07:30:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot6h1-0005j2-Rt for bug-guix@gnu.org; Thu, 10 Nov 2022 07:30:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot6h1-00076B-E9 for bug-guix@gnu.org; Thu, 10 Nov 2022 07:30:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ot6h0-00077E-Sw for bug-guix@gnu.org; Thu, 10 Nov 2022 07:30:02 -0500 Subject: bug#58732: installer: finalizers & device destroy segfault Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-To: bug-guix@gnu.org Resent-Date: Thu, 10 Nov 2022 12:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 58732 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 58732-done@debbugs.gnu.org Mail-Followup-To: 58732@debbugs.gnu.org, othacehe@gnu.org, othacehe@gnu.org Received: via spool by 58732-done@debbugs.gnu.org id=D58732.166808336527274 (code D ref 58732); Thu, 10 Nov 2022 12:30:02 +0000 Received: (at 58732-done) by debbugs.gnu.org; 10 Nov 2022 12:29:25 +0000 Received: from localhost ([127.0.0.1]:42195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot6gO-00075q-TJ for submit@debbugs.gnu.org; Thu, 10 Nov 2022 07:29:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56182) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot6gK-00075Y-Q5 for 58732-done@debbugs.gnu.org; Thu, 10 Nov 2022 07:29:23 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot6gE-000590-SC; Thu, 10 Nov 2022 07:29:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=olA+FbIt7zWxumi1qExSJjn2CTwiWb1qBNdH2UX45L4=; b=W0mgNj6lETKVROJZvnfQ GhamEpxLzuoAkcLoOfnvAANYGHj3mL/02CezjgbbVorWBxZTyNsWJIT5pr7BVnOlHCbtckwOek61T qdig7hSB+9tN64Vs5vmeLka9/W0/xGeBP4qx3me+B3J2fKu5q/Mt8Fh7+NZVkyxhcU5Cpp+RMrX+7 ZubnVLBkAcvpIOKmEhaua2cyTRA0C9t0vRTfCyG6ISlL5D00jiI/sWyu+4SIh8nfew3tGlAr08TUT NNueqcNn+2+IXOOqi1faNR3xe5pM9Qdc07CXXA8O88PlCQVws5kJ6GofTVQl6IX/BLcysltZRjk09 xw5nDRQlGBCk/Q==; Received: from 2a02-8429-81d2-3d01-94c9-8097-ea5c-2775.rev.sfr.net ([2a02:8429:81d2:3d01:94c9:8097:ea5c:2775] helo=meije) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot6gE-0000U9-AW; Thu, 10 Nov 2022 07:29:14 -0500 From: Mathieu Othacehe References: <87v8oa29ik.fsf@gnu.org> <871qqlwrpy.fsf@gnu.org> <87iljwuwf7.fsf@gnu.org> <871qqkth3g.fsf@gnu.org> <87sfiwm297.fsf@gnu.org> <87iljquc3a.fsf@gnu.org> <8735auwwjf.fsf@gnu.org> <87tu38m9oc.fsf@gnu.org> <87edubjasj.fsf@gnu.org> Date: Thu, 10 Nov 2022 13:29:10 +0100 In-Reply-To: <87edubjasj.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 10 Nov 2022 12:42:20 +0100") Message-ID: <87r0ybyovd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668083436; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-to: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=olA+FbIt7zWxumi1qExSJjn2CTwiWb1qBNdH2UX45L4=; b=kkXi5hjKNLoeGTfVWvYLCR85PD5EEtFITNIpMJWsgRoSktiXeYYyb/Z72JgRm3SlHGhN/A GIZroSr7dtxLAIdUgvALOma/uCufjjgmE2Iqgv56r0iS37+Hn9pdsl9q8Nk/J+X+UFqsEb uSAaeXiNxEA0Z728iM6Zdvr+reNtciSgtM+rabQ6VLjFHnkVtOyiRlOvB9qSn/n7uATjRl BYCCQpqr5Vjk7SdgUXVKoHpcMQ+s/JCK0SMZoUyoIYdlvVJVUHaIuA7F2uq4/5CXcnOy8D ZQRD8nPaAkwytafrCaw2Tebui/uArmaLcLz5CXemMnyjOZphqPiBAD+lXe6Xww== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668083436; a=rsa-sha256; cv=none; b=hRi0inu+SSH6zUizSuteyfi/tvxuobgfmVKDESgDRugXqLlGj4FrnJehl0jh1ASJ4OnJZE 6p5ArCbLafsTf/Cu0BRt9b9M3tl6VaMbOqFg+Xq7ko/wiJI33VDUg569GQAA1PyVUcf+/a wWEFwxA5s2mVnIO6sxYjJzMFRJYb1WDpZslKJj5v05kQo97fE2TTuhEZk5BOd6/6a/Tar6 OiQxMeQeMdfNlxO64oHfr7i1mBjTHych9KOFIg1l+PU/gHfAd1sdCVjDqbGS2qTIm+cykj wR51beG6kP3UV1n32D2BHI8gvHrgFO8kHKIx4n0DGFEZsKnOCinWT3Al/qadxQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=W0mgNj6l; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.02 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=W0mgNj6l; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: E59762FC54 X-Spam-Score: -3.02 X-Migadu-Scanner: scn0.migadu.com X-TUID: M18ShxMl229+ Hey, > Looking at device.c in Parted, that=E2=80=99s probably the right thing be= cause > PedDevice objects are kept in a linked list whose head is stored in the > =E2=80=98devices=E2=80=99 global variable of device.c. So you cannot jus= t free them > asynchronously from a finalizer thread because they might still be > accessed from other parts of the library. This is the explanation that > should go in the comment, and it=E2=80=99s clearly a good reason not to f= ree > those PedDevice objects. If the finalizer was run synchronously when a device is removed from the weak hash table then things would be OK. The device would be removed from the global linked list by _device_register. get_device would malloc a new structure and so on. However finalizers are not run synchronously so here we are. > Now, we could provide bindings for =E2=80=98ped_device_destroy=E2=80=99 t= hat users could > explicitly call if they want to (this would be similar to explicit calls > to =E2=80=98close-port=E2=80=99). We=E2=80=99d arrange to make it idempo= tent. Sure. Thanks for your help on that one. I pushed the proposed patch and updated Guile-Parted to 0.0.7 in Guix. Mathieu