From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 135525A0269 for ; Wed, 02 Dec 2026 12:49:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796212148; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=Gpsh5td6nCL/teQWbrj1wBcyK9SQnYTS9cHBDTelTBQ=; b=TwidBQc9+pQ2zq19nMJv15//q899uaVLMnjzPH0xrTxlQZBpX8E6ctNH9u0TbSGUKkd8Rq ioU8E8wwyC1OwOXSJK3aGzmzmZ0R72ar2OMTnfhBUzOr2tDs3h5NJF0/mnux3vv1IUCgJQ cYnpDKw9OZMZYb+YdbV02Jf+MXInX0Y= X-MC-Rep: binary re single Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-tZMwW56HPG2z1DbpiRU6Mw-1; Wed, 2 Dec 2026 11:49:07 +0000 X-MC-Unique: tZMwW56HPG2z1DbpiRU6Mw-1 X-Mimecast-MFC-AGG-ID: tZMwW56HPG2z1DbpiRU6Mw_1796212146 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-490c1867460so6860588f8f.2 for ; Wed, 02 Dec 2026 03:49:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796212146; x=1796816946; h=date:content-transfer-encoding:content-type:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id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9SBtqr5+a2dY0NGEe2y5n ad4gtCZHoAOGr2CWDh0B+hl71rISLt5kyRH/y4O6Y5kLDkWZmfmImmlp+E+o/4Ei6mBcFw32khq R6MKKH/0T2 X-Received: by 2002:a05:6000:40ca:b0:4a3:976e:27a2 with SMTP id ffacd0b85a97d-4abb5146238mr77510925f8f.34.1796212145979; Wed, 02 Dec 2026 03:49:05 -0800 (PST) X-Received: by 2002:a05:6000:40ca:b0:4a3:976e:27a2 with SMTP id ffacd0b85a97d-4abb5146238mr77510869f8f.34.1796212145391; Wed, 02 Dec 2026 03:49:05 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4bef07f9e0dsm27070226f8f.53.2026.12.02.03.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 03:49:04 -0800 (PST) From: Stefano Brivio To: eldritch horrors Subject: Re: pasta: patches for --pass-fds (fix) and --ready-fd (new) Message-ID: <20261202124901.0ab686fd@elisabeth> In-Reply-To: <6d2ed11c-0109-409c-b584-adbdc43fb862@lix.systems> References: <20261124192024.0e16f855@elisabeth> <6a3d919f-8fe9-4473-ac11-7d3d1a4b6173@lix.systems> <20261127232541.2474fc81@elisabeth> <6d2ed11c-0109-409c-b584-adbdc43fb862@lix.systems> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Wed, 02 Dec 2026 12:49:03 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4Agew4M82mytfsU1dWCcdBxr5Lc7_kxVZn4Cl3xrYQY_1796212146 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: XZXROYVBVMXTMCJ2AEN5DVP25YNV7VIC X-Message-ID-Hash: XZXROYVBVMXTMCJ2AEN5DVP25YNV7VIC X-MailFrom: sbrivio@redhat.com 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: Lisanna Dettwyler , passt-dev@passt.top, raito@lix.systems, sergei@zimmerman.foo, Paul Holzinger 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: On Sun, 29 Nov 2026 21:11:22 +0100 eldritch horrors wrote: > hi, > > On 27/11/2026 23:25, Stefano Brivio wrote: > > I think we had some issue with this at some point, it works for me now, > > but I have a vague memory of another use case (probably Buildah?) where > > this wasn't a possibility at all. I tried both: > > we've retested these, and today they work. we can totally pass a PID to > pasta and have it open its namespace files, so that's no longer a > problem. excellent :) we're no longer sure what the original problem was > here, but that bit does look solved without any sort of fd passing. Hah, great, thanks for re-testing! > >> we also need to tear down pasta *quickly* once our processes using the > >> isolated network terminate. we can run hundreds of them per second, > >> leaving pasta instances around until they find the namespace gone is the > >> kind of drain on resources our scheduler wants to avoid, and on highly > >> loaded system we can't even guarantee that any given pasta instance can > >> check whether its namespaces are still live in any reasonable amount of > >> time. > > > > Hmm, okay, if you can't give pasta a namespace handle, then pasta's own > > clean-up mechanism won't be quick (see commit I mentioned above > > introducing a timer for that). > > > > I think the most appropriate solution would be the pidfd idea outlined > > here as "option 2": > > > > https://github.com/podman-container-tools/podman/pull/27901#issuecomment-3819074744 > > > > which could actually be entirely race-free: > > > > https://github.com/podman-container-tools/podman/pull/27901#issuecomment-3823473179 > > > > ...so that you can keep the clean synchronisation / demonisation on > > start-up, and still have a fast and robust mechanism to terminate it. > > What do you think? > > that could be workable, but "works since 6.14" is a caveat we currently > can't work with. we've checked the linux source, and 6.14 is indeed a > lower bound for when this trick would work. Note that we strive to maintain compatibility with (much) older kernel versions (4.18 or so). If something works since 6.14, of course, we'd make sure to have a workaround carrying some risk of an unlikely and relatively harmless race condition on older kernels. > we don't fully understand why a readiness fd is scary here Because you can do a lot of things on a file descriptor, and it's one more thing from the "outside world" pasta could touch. It's not particularly scary, it's just as scary as other interfaces. And the fewer interfaces we can have, the better. > but we're > also not that well-versed in how the different LSMs treat inherited file > descriptors. Actually, I had something completely unrelated in mind when I wrote that. I was mistakenly thinking of something path-based, sorry. It wouldn't be the case. So, actually, policy-wise it's all unproblematic. That's one aspect that makes it a bit more scary though: LSMs wouldn't see that at all. You can say stuff like "pasta is allowed to receive SIGTERM from Podman" (and no other signals, from no other processes), but you can't decide what pasta can do with that file descriptor at all: everything goes, including, say, calling fsconfig(2) on it. > we'd be totally happy if pasta just kept an fd to close > where it would normally fork, with nothing else done to the fd under any > circumstances. > > all this aside it seems that we could use the pidfile option to have > pasta write its pid to a fifo and use the appearance of data as a "would > have daemonized here" signal. Hmm, what if pasta optionally writes its PID to stdout, as Paul was also proposing on that ticket? That's an interface we already have. > this feels strictly inferior to a > readiness fd passed via inheritance[1], but we do suppose (without > having tested it yet) that this should work. if it does we'd have a > significantly less crimes-y solution with current pasta versions, but > we'd still prefer a readiness fd for signaling. that just seems like the > much cleaner solution on the consumer side, with no filesystem pollution > or other interference to worry about. > > [1]: having a stable name in the filesystem would let other applications > very easily signal pasta readiness and subsequently either have pasta > hang (if we don't unlink the fifo as early as possible) or write junk to > disk (if we do unlink the fifo early), though this is also a potential > problem with inherited fds thanks to the /proc/*/fd/* links. closing an > inherited fd is not vulnerable to this kind of interference; we can > inject data via magic links, but not closes. I see your point in general, except that a filesystem can be used to police things using LSMs, *and* pasta could close the file before a container starts interacting it. At this point, I'm convinced enough by your argument that I'm kind of ambivalent towards it. * * * By the way, we eventually had to add another interface, recently, which is a full-fledged (optional) control socket, because container runtimes need to add and remove port mappings at runtime. It can be accessed via pesto(1) using a simple binary protocol. It's a more involved interface, indeed, but we couldn't avoid it, and access is policed via regular filesystem permissions as well as via LSMs. On top of that, pasta doesn't get any file descriptor from another process: it's a UNIX domain socket with its abstraction, which also offers some implicit isolation. If there's the possibility that Lix might need to use it as well in the future, then we could just use that right now to terminate pasta. We could even ship a minimal client, say, basta(1), whose only job is to write a single "quit" command to the UNIX domain socket. Would that be appealing in any way? -- Stefano