[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
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-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?
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