public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: eldritch horrors <pennae@lix.systems>
Cc: Lisanna Dettwyler <lisanna.dettwyler@gmail.com>,
	passt-dev@passt.top, raito@lix.systems, sergei@zimmerman.foo,
	Paul Holzinger <pholzing@redhat.com>
Subject: Re: pasta: patches for --pass-fds (fix) and --ready-fd (new)
Date: Fri, 27 Nov 2026 23:25:42 +0100 (CET)	[thread overview]
Message-ID: <20261127232541.2474fc81@elisabeth> (raw)
In-Reply-To: <6a3d919f-8fe9-4473-ac11-7d3d1a4b6173@lix.systems>

[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 <pennae@lix.systems> 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

      reply	other threads:[~2026-11-27 22:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 22:11 Lisanna Dettwyler
2026-11-24 18:20 ` Stefano Brivio
2026-11-24 18:46   ` Sergei Zimmerman
2026-11-24 21:32     ` Stefano Brivio
2026-11-26 19:04   ` eldritch horrors
2026-11-27 22:25     ` Stefano Brivio [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127232541.2474fc81@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=lisanna.dettwyler@gmail.com \
    --cc=passt-dev@passt.top \
    --cc=pennae@lix.systems \
    --cc=pholzing@redhat.com \
    --cc=raito@lix.systems \
    --cc=sergei@zimmerman.foo \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).