From: Stefano Brivio <sbrivio@redhat.com>
To: Sergei Zimmerman <sergei@zimmerman.foo>
Cc: Lisanna Dettwyler <lisanna.dettwyler@gmail.com>,
passt-dev@passt.top, pennae@lix.systems, raito@lix.systems
Subject: Re: pasta: patches for --pass-fds (fix) and --ready-fd (new)
Date: Tue, 24 Nov 2026 22:32:32 +0100 (CET) [thread overview]
Message-ID: <20261124223231.0d9c94a0@elisabeth> (raw)
In-Reply-To: <W8-uWkbAfDylvEA9-p9MTTv96aucsZYvFLgWZ33Ftb1JIV66tEs4Qp_1PcBTHxOtRjydAMDoWO6K-dbk82TmnZgHzYRAy3bsABmubk9p1_U=@zimmerman.foo>
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
prev parent reply other threads:[~2026-11-24 21:32 UTC|newest]
Thread overview: 4+ 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 [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=20261124223231.0d9c94a0@elisabeth \
--to=sbrivio@redhat.com \
--cc=lisanna.dettwyler@gmail.com \
--cc=passt-dev@passt.top \
--cc=pennae@lix.systems \
--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).