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 IPIwK4jwb2KUwgAAbAwnHQ (envelope-from ) for ; Mon, 02 May 2022 16:54:00 +0200 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 sAhZKojwb2JtaAEAG6o9tA (envelope-from ) for ; Mon, 02 May 2022 16:54:00 +0200 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 BC5311E9C7 for ; Mon, 2 May 2022 16:53:58 +0200 (CEST) Received: from localhost ([::1]:46264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlXQv-000733-RF for larch@yhetil.org; Mon, 02 May 2022 10:53:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlXQ7-0005oZ-0q for bug-guix@gnu.org; Mon, 02 May 2022 10:53:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlXQ6-0004oY-OJ for bug-guix@gnu.org; Mon, 02 May 2022 10:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlXQ6-0005aU-Ls for bug-guix@gnu.org; Mon, 02 May 2022 10:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#55223: Shepherd 0.9.0 =?UTF-8?Q?=E2=80=98make-inetd-constructor=E2=80=99?= can leak file descriptors Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 02 May 2022 14:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55223 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 55223@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165150313421415 (code B ref -1); Mon, 02 May 2022 14:53:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 May 2022 14:52:14 +0000 Received: from localhost ([127.0.0.1]:37650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlXPJ-0005ZL-S4 for submit@debbugs.gnu.org; Mon, 02 May 2022 10:52:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:51786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlXPI-0005ZE-6j for submit@debbugs.gnu.org; Mon, 02 May 2022 10:52:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlXPH-0004Zw-Uk for bug-guix@gnu.org; Mon, 02 May 2022 10:52:11 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:32890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlXPF-0004kz-ON for bug-guix@gnu.org; Mon, 02 May 2022 10:52:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=dkXcGAsx2XP6x21WZYHOpfjQHrl4MLBL/PIFgfOlC4I=; b=UbbOl7OMEAFJ2eCTL2VaRPNZlkSOsYhKhhSJdRTaf1cD1gCs0WQi/igX DiPOOVazf8hjz2LBcw7xsBaZp6g/PTSZ3MZqzTZGYepCg5VzyDMkonmAC IirF4RK4gkTjok933/XfkO85dN5gJp7K6sIlMleELZkBgk5oPIfqwMras Y=; X-IronPort-AV: E=Sophos;i="5.91,192,1647298800"; d="scan'208";a="12973074" Received: from unknown (HELO ribbon) ([193.50.110.83]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2022 16:52:05 +0200 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 13 =?UTF-8?Q?Flor=C3=A9al?= an 230 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 02 May 2022 16:52:05 +0200 Message-ID: <87fslsrnqi.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=192.134.164.104; envelope-from=ludovic.courtes@inria.fr; helo=mail3-relais-sop.national.inria.fr X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651503238; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=dkXcGAsx2XP6x21WZYHOpfjQHrl4MLBL/PIFgfOlC4I=; b=nztBGqB65sFvpplFZoIIsK+emg5Q5vjHUo9xKpCMGWP15jYuIDoy4qKvJriSXK1O3IJiIJ x4KvbNaG9YvNB+PohjystWC6X61cwmmeYVUJe9cQxIyyOmsjnv7dzliN9DgbYIH8CZM019 S7yn6vX6SoeP+YvROJFUFq4a4VB8jb4lXZh+WRTlvp4TfD0fyT2q7vvBxCM6FAiEp5asSb WcQfDvfaoRdZffZeKFeP7Epj+Lo+OkF0Kwvwy+1+wluzhidlY3q1ydtkLj8MAjO1IoOd10 ZVREU/8pniHnze23dnPaWh9XmaVsuDDv9Kdy/VfYPujCseOeWRK6o8nGM/GW7A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651503238; a=rsa-sha256; cv=none; b=OGGIwiINSA7TQyR+QxpJCgjkdlch4inCiOCnf4vWkLnl6KPvHIaGKKNGmashnf+DSByquS qKG1WxFlypwhjxPHkapRxCEpB1MPvH396a48xaCt5EP15Mw5rj5em+iJCPENWvo4cnqih1 8sS7y0bdorrkLQFs3QWyUJmIHrvleL6NX/RYZYCILsY+nIbGZPSJ+icFEarCpMb6OTHuIS 3y8EagfUlQGmLBXP0B+sbOA9eQkb9qwwh+gdDJD910/LWkzQUDXRDf9T+soKWh3FCjnKgG 0WmGyyqPjFLPIIzModeZDxV0/2TBuDrQk+Ta0jUsuJnbBHo7IEglW3syyYB8fA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=inria.fr header.s=dc header.b=UbbOl7OM; dmarc=fail reason="SPF not aligned (relaxed)" header.from=inria.fr (policy=none); 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: 7.70 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=inria.fr header.s=dc header.b=UbbOl7OM; dmarc=fail reason="SPF not aligned (relaxed)" header.from=inria.fr (policy=none); 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: BC5311E9C7 X-Spam-Score: 7.70 X-Migadu-Scanner: scn1.migadu.com X-TUID: NP/cJ6N1S96f =E2=80=98make-inetd-constructor=E2=80=99 creates a socket and then calls bi= nd(2) on it. --8<---------------cut here---------------start------------->8--- (lambda args (let ((sock (non-blocking-port (socket (sockaddr:fam address) socket-style 0))) [=E2=80=A6]) (setsockopt sock SOL_SOCKET SO_REUSEADDR 1) [=E2=80=A6] (bind sock address) --8<---------------cut here---------------end--------------->8--- If bind(2) fails, for instance with EADDRINUSE, the socket it created is leaked; it will be closed =E2=80=9Ceventually=E2=80=9D, when GC runs, but t= hat could happen much later. Solution is to use some sort of =E2=80=98unwind-protect=E2=80=99 and close = it upon exception. Ludo=E2=80=99.