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 825DB5A026E for ; Fri, 27 Nov 2026 23:25:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795818347; 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=pU1Pde5BCiuTf0fDTe8Dipbo4YXRxy+zpa5/Z5gHrro=; b=EaZ/7hZuWunRy1LedF6WNtbwNrlwOHWvNLVIIwzFXaO8mad55GIrtFwz4U/oIVSerlcvWw FEoDG+Ar2g86Hs990l7LdA64rOcUiTPSC7fh6+DTGogCko5mfusu3n5wARUV+m/c6pdPot dob30Tq9iLEZNbyR4oO4dDBueRC1Amc= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-5WXa81_2OQCQ5RtXXxTw3A-1; Fri, 27 Nov 2026 22:25:45 +0000 X-MC-Unique: 5WXa81_2OQCQ5RtXXxTw3A-1 X-Mimecast-MFC-AGG-ID: 5WXa81_2OQCQ5RtXXxTw3A_1795818344 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a17741243eso12056745e9.0 for ; Fri, 27 Nov 2026 14:25:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795818344; x=1796423144; 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 :reply-to:content-type; bh=pU1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dwN4rS4lLAS1L6tMIM66Zt4H0TO6iHe26g2QlJNsTamMxCUf8c3k= X-Received: by 2002:a05:600c:a0d:b0:4a1:825a:56fd with SMTP id 5b1f17b1804b1-4bb88826c1fmr500706685e9.32.1795818343819; Fri, 27 Nov 2026 14:25:43 -0800 (PST) X-Received: by 2002:a05:600c:a0d:b0:4a1:825a:56fd with SMTP id 5b1f17b1804b1-4bb88826c1fmr500706285e9.32.1795818343202; Fri, 27 Nov 2026 14:25:43 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb853a12acsm754845025e9.8.2026.11.27.14.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Nov 2026 14:25:42 -0800 (PST) From: Stefano Brivio To: eldritch horrors Subject: Re: pasta: patches for --pass-fds (fix) and --ready-fd (new) Message-ID: <20261127232541.2474fc81@elisabeth> In-Reply-To: <6a3d919f-8fe9-4473-ac11-7d3d1a4b6173@lix.systems> References: <20261124192024.0e16f855@elisabeth> <6a3d919f-8fe9-4473-ac11-7d3d1a4b6173@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: Fri, 27 Nov 2026 23:25:42 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: FnRHa884PrDiy4WaYXWOB9CWJl8Y8N9KYUOlT6USJyo_1795818344 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: EC7QRBAKDU23ARLYL25FO4DQWXWLNOM4 X-Message-ID-Hash: EC7QRBAKDU23ARLYL25FO4DQWXWLNOM4 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: [Cc'ing Paul who knows better how Podman does some of this] Hi, Thanks for the details, that starts looking like a more precise list of requirements. Some comments and some questions for now: On Thu, 26 Nov 2026 20:04:34 +0100 eldritch horrors wrote: > hi, > > On 24/11/2026 19:20, Stefano Brivio wrote: > > ...and at that point it looked like you could just let pasta do its job > > and daemonise itself, but there were some residual issues with > > capabilities you were investigating. > > > > Did you find out anything else? Is there another way we can fix this? > > > > My concerns from back then remain. I would like to keep pasta's > > interfaces as simple, limited, conventional, and boring as possible, > > for ease of auditing and also for the sake of LSM policies, and the > > current model just works for Podman and moby / rootlesskit. > > that just doesn't seem to work for us. we can't pass a PID for pasta to > pull namespaces from because it'll fail to adopt user namespaces when > run with non-root credentials. 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: - detaching user and network namespaces first, then joining them from pasta (I guess that would be the case for Nix / Lix?): $ unshare -rUn # echo $$ 1090417 [from another terminal] $ pasta -f --config-net 1090417 Template interface: enp9s0 (IPv4), enp9s0 (IPv6) [...] - detaching just a user namespace first, running pasta from there, and having it detach the network namespace: $ unshare -rU # ./pasta --config-net --netns-only -- ping -qc1 2600:: PING 2600:: (2600::) 56 data bytes --- 2600:: ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 35.498/35.498/35.498/0.000 ms If this doesn't work for you for some reason: > we can't pass procfs paths to namespace > descriptors on other processes because pasta can't even open them in > that case for some reason? ...this is what Buildah or podman-build do. We had an issue with SELinux recently: e74a7c2c1824 ("selinux: Access to netns for podman-build, read access for netns in general") and one with inotify a couple of years ago: ff22a78d7b52 ("pasta: Don't try to watch namespaces in procfs with inotify, use timer instead") but it should all be solved now. Do you happen to remember the issue you were getting with this? > when running pasta with high capabilities and > letting it drop privs this works reasonably well, Ouch, definitely not the intended usage. > but we must also > support unprivileged instances with user namespaces. Right, yes, absolutely. > some sort of fd > passing seems to be essential to make our use case work at all. If this is needed anyway: I'd suggest that instead of using --pass-fds for that (and changing it as Lisanna's patch is doing), we add a separate --netns-fd option, so that we join that network namespace (that's the only one you need, right?) and close it, together with any possibly leaked file descriptor. If the other options above don't work for you, would this one work? > 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? > we could probably get around *that* by shoving pasta into a fresh > pid namespace under a manager as pid1, then killing that manager and > having the manager wait for pasta to fork. That looks complicated. Somewhat related, by the way: https://bugs.passt.top/show_bug.cgi?id=225#c6 but that won't really help in your case. -- Stefano