From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202606 header.b=C8y2+btd; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 1BE5D5A026E for ; Fri, 17 Jul 2026 07:46:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202606; t=1784267197; bh=+wQTBI5k33KJj7ezXc2Xw8m/xNM+C3G4aPz/QwdZV3o=; h=From:To:Cc:Subject:Date:From; b=C8y2+btdldMFw6L87jVkxPxrcUc9f71AaGqg/AsCeRdgX0lxx6piA2UJSW+8nxicy Op9PtfMJ8kWNrdtNLBqotyremQNJhrScLDobiywrbujkMvYOYuqDsnXM+XRtt6jLVt Cw273K5Hp+BYQhG9UQT+f0VenKhj2XDEnUbCkJFOvVaJ7xoXKOQ95I3iTbI+65Hv9B zG3zyrdh0RZGKYk9zisjUL0Okee3sCRDcz3cMDkxAkZz8Kk0vsFHeo8hmgcUikFTEg Bjp/ljDOtWH1vNLo1aLAanH3vEEY3gW9EDw+2jVJuTVBRfmVLV0be+xeAPcy06oeMd m2bb0DRgFvL9A== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4h1f6h74Gsz4w9j; Fri, 17 Jul 2026 15:46:36 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 0/6] Fix bug 215 and some related issues with fd handling Date: Fri, 17 Jul 2026 15:46:28 +1000 Message-ID: <20260717054634.1293553-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.55.0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: IITUFHACJFYIOVWDITDXNWAJH76S2SSV X-Message-ID-Hash: IITUFHACJFYIOVWDITDXNWAJH76S2SSV X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Stefano, you called it correctly. While working on bug 215, as usual, I found a bunch of adjacent things to clean up. I did start by attempting the appoach you suggested for bug 215 - remembering which of the low fds were standard streams and avoiding closing them in __daemon(). It is indeed shorter, but only by 1-2 lines. Looking at possible interactions with other things, I became more and more convinced that leaving anything other than the standard streams in fds 0-2 was an accident waiting to happen. Much of the rest of the series is, for example, dealing with the possibility of --fd [012]. v2: * No longer fold fd closing into isolate_initial() * Some minor polish * Various improved comments and commit messages David Gibson (6): passt: Always close pidfile_fd, not just when daemonizing isolation: Move close_open_files() to isolate_fds() isolation, conf: Set c->fd_tap from early parse of --fd conf: Make conf_tap_fd() operate more like conf_mode() isolation: Move --fd descriptor to a number of our choosing main: Ensure fds 0-2 are populated conf.c | 31 ++++++++++++++++++++------- conf.h | 2 +- isolation.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++------- isolation.h | 3 ++- passt.c | 28 +++++++++++++++++-------- util.c | 52 +--------------------------------------------- util.h | 1 - 7 files changed, 98 insertions(+), 79 deletions(-) -- 2.55.0