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.
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-381...
which could actually be entirely race-free:
https://github.com/podman-container-tools/podman/pull/27901#issuecomment-382...
...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. we don't fully understand why a readiness fd is scary here, but we're also not that well-versed in how the different LSMs treat inherited file descriptors. 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. 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.