public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* pasta: patches for --pass-fds (fix) and --ready-fd (new)
@ 2026-11-23 22:11 Lisanna Dettwyler
  2026-11-24 18:20 ` Stefano Brivio
  0 siblings, 1 reply; 4+ messages in thread
From: Lisanna Dettwyler @ 2026-11-23 22:11 UTC (permalink / raw)
  To: passt-dev; +Cc: pennae, raito, sergei

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

Hello!

I have a couple patches that makes pasta easier for us to use. --ready-fd
allows us to wait on fd activity rather than sleep polling with an ioctl
(we do not want to let pasta daemonize itself). --pass-fds is fixed to
allow opening namespaces by inherited parent fd.

https://github.com/lisanna-dettwyler/passt/compare/master...dev-nix

Please let me know if these can be merged! We are interested as both
https://nixos.org and https://lix.systems/

Thanks,
Lisanna

[-- Attachment #2: Type: text/html, Size: 823 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pasta: patches for --pass-fds (fix) and --ready-fd (new)
  2026-11-23 22:11 pasta: patches for --pass-fds (fix) and --ready-fd (new) Lisanna Dettwyler
@ 2026-11-24 18:20 ` Stefano Brivio
  2026-11-24 18:46   ` Sergei Zimmerman
  0 siblings, 1 reply; 4+ messages in thread
From: Stefano Brivio @ 2026-11-24 18:20 UTC (permalink / raw)
  To: Lisanna Dettwyler; +Cc: passt-dev, pennae, raito, sergei

Hi Lisanna,

On Mon, 23 Nov 2026 17:11:39 -0500
Lisanna Dettwyler <lisanna.dettwyler@gmail.com> wrote:

> Hello!
> 
> I have a couple patches that makes pasta easier for us to use.

...and that's indeed a relevant goal for passt as a project, by all
means, but I still have some questions about this:

> --ready-fd
> allows us to wait on fd activity rather than sleep polling with an ioctl
> (we do not want to let pasta daemonize itself). --pass-fds is fixed to
> allow opening namespaces by inherited parent fd.
> 
> https://github.com/lisanna-dettwyler/passt/compare/master...dev-nix

We discussed about this some months ago, remember?

  https://archives.passt.top/passt-dev/CAC-VXLYqvXu+yHsM=DUt-7MSGp_+o8Wt5zgGYzi1gdNvtoRK-A@mail.gmail.com/

...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.

> Please let me know if these can be merged! We are interested as both
> https://nixos.org and https://lix.systems/

If this is the only way you can fix things up, sure... but there seemed
to be hope?

-- 
Stefano


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pasta: patches for --pass-fds (fix) and --ready-fd (new)
  2026-11-24 18:20 ` Stefano Brivio
@ 2026-11-24 18:46   ` Sergei Zimmerman
  2026-11-24 21:32     ` Stefano Brivio
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Zimmerman @ 2026-11-24 18:46 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: Lisanna Dettwyler, passt-dev, pennae, raito

> and at that point it looked like you could just let pasta do its job
and daemonise itself

Forgive me if I’m slightly incorrect on the details, but here’s the simplification that can be done in the lix build launcher: https://gerrit.lix.systems/c/lix/+/6897

There’s several arguments I see for the ready pipe:

* Asynchronous waiting for the child exit is painful without pidfd. This seems relevant for lix.

* The setup completion is waited upon in another child process of lix while the parent that spawned pasta goes off on its merry way, so I’m not even sure you *could* wait for the daemonization to complete in this process setup? I’d need to brush up on pidfd polling and whether it can work around wait4 limiting you to child processes.

As for the other commit, fd inheritance seems like a useful simplification. Closing leaked FDs is the parent’s responsibility that cppnix and lix* already handle so whatever is inherited is done intentionally.

Best regards,
Sergei

-------- Original Message --------
On Tuesday, 11/24/26 at 22:20 Stefano Brivio <sbrivio@redhat.com> wrote:
Hi Lisanna,

On Mon, 23 Nov 2026 17:11:39 -0500
Lisanna Dettwyler <lisanna.dettwyler@gmail.com> wrote:

> Hello!
>
> I have a couple patches that makes pasta easier for us to use.

...and that's indeed a relevant goal for passt as a project, by all
means, but I still have some questions about this:

> --ready-fd
> allows us to wait on fd activity rather than sleep polling with an ioctl
> (we do not want to let pasta daemonize itself). --pass-fds is fixed to
> allow opening namespaces by inherited parent fd.
>
> https://github.com/lisanna-dettwyler/passt/compare/master...dev-nix

We discussed about this some months ago, remember?

  https://archives.passt.top/passt-dev/CAC-VXLYqvXu+yHsM=DUt-7MSGp_+o8Wt5zgGYzi1gdNvtoRK-A@mail.gmail.com/

...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.

> Please let me know if these can be merged! We are interested as both
> https://nixos.org and https://lix.systems/

If this is the only way you can fix things up, sure... but there seemed
to be hope?

--
Stefano


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pasta: patches for --pass-fds (fix) and --ready-fd (new)
  2026-11-24 18:46   ` Sergei Zimmerman
@ 2026-11-24 21:32     ` Stefano Brivio
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Brivio @ 2026-11-24 21:32 UTC (permalink / raw)
  To: Sergei Zimmerman; +Cc: Lisanna Dettwyler, passt-dev, pennae, raito

On Tue, 24 Nov 2026 18:46:29 +0000
Sergei Zimmerman <sergei@zimmerman.foo> wrote:

> > and at that point it looked like you could just let pasta do its job  
> > and daemonise itself
> 
> Forgive me if I’m slightly incorrect on the details, but here’s the
> simplification that can be done in the lix build launcher:
> https://gerrit.lix.systems/c/lix/+/6897

Sure, I understand that's a significant simplification.  It's the same
as what we discussed back in June, though.

I'm just suggesting that you can get the same simplification by letting
pasta do its course, that is, drop the '--foreground' option, and it
will behave like all regular UNIX daemons do: it forks to background
once it's ready, and not a moment before:

  https://archives.passt.top/passt-dev/cbe5ab63-3266-4234-8745-5a6583039809@redhat.com/

  https://archives.passt.top/passt-dev/20260527213924.2586bca5@elisabeth/

No reason for a side channel just because slirp4netns had it.  And yes,
Podman used to do that too, but eventually I convinced them to fix that.
:)

When you're done with the namespace, you don't need to track pasta at
all: just remove the namespace handle, and pasta goes away.

I saw the "We don't let it daemonize itself for process managements
reasons" comment, it was the same in June, but when Lisanna checked it
appeared to be a left-over.  Or at least we couldn't figure out what
those particular "process managements reason" were.

If you want something explicit for corner cases, though:

> There’s several arguments I see for the ready pipe:
> 
> * Asynchronous waiting for the child exit is painful without pidfd.
>   This seems relevant for lix.

...we discussed providing a pidfd for some particular use cases in
Podman as well.  All pasta can do (on top of automatic exit) is to
write a PID file, but it's racy, strictly speaking.

If that solves a problem for Lix as well, let's implement that
instead.

This --ready-fd option scares me enough (both in terms of letting
something "wrong" slip in now, as well as hours of fun with AppArmor /
SELinux once others start using it) that I'd rather be inclined in
investing a bit of time in the pidfd thing myself.

Of course, I don't want to force that option if it's really not
suitable for your purposes... but perhaps it is?

> * The setup completion is waited upon in another child process of lix
>   while the parent that spawned pasta goes off on its merry way, so I’m
>   not even sure you *could* wait for the daemonization to complete in
>   this process setup?

Just fork(), exec(), and wait for the child to exit before proceeding,
instead of keeping a separate child process around implementing more
specific synchronisation.  Even with a file descriptor indicating
readiness, you would need to wait anyway, right?

>   I’d need to brush up on pidfd polling and whether
>   it can work around wait4 limiting you to child processes.

I think you could still use wait4() or similar.

> As for the other commit, fd inheritance seems like a useful
> simplification. Closing leaked FDs is the parent’s responsibility that
> cppnix and lix* already handle so whatever is inherited is done
> intentionally.

Until you forget to do that, and then it's our responsibility. :) And
even if it's not, it risks getting catastrophically bad.

I mean, if people want to run Bubblewrap *inside* pasta, ouch... but
fine, there I understand the need to pass file descriptors down to the
spawned command.

But if you don't need to let pasta spawn any command, if the only
purpose is to pass a network namespace without using a filesystem path,
then give pasta your PID?  Wouldn't that work?

If, for some reason I'm missing, you really need to pass the namespace
as file descriptor, I'd rather implement that as a special option that
only applies to network namespaces and nothing else, and keep closing
any (otherwise) leaked file descriptor.

I really would like to avoid the risk of having anything unnecessary
and potentially dangerous in pasta's descriptor table, *if possible*.

-- 
Stefano

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-24 21:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 22:11 pasta: patches for --pass-fds (fix) and --ready-fd (new) Lisanna Dettwyler
2026-11-24 18:20 ` Stefano Brivio
2026-11-24 18:46   ` Sergei Zimmerman
2026-11-24 21:32     ` Stefano Brivio

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).