From: Stefano Brivio <sbrivio@redhat.com>
To: Richard Lawrence <rlawrence@tamu.edu>
Cc: passt-dev@passt.top, jbash@jbash.com,
Richard Lawrence <rarensu@tamu.edu>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH v3] feat: Add cli option '--pass-fds' for pasta mode.
Date: Mon, 20 Jul 2026 19:44:02 +0200 (CEST) [thread overview]
Message-ID: <20260720194401.2eb998dd@elisabeth> (raw)
In-Reply-To: <20260719200300.201469-1-rlawrence@tamu.edu>
Hi Richard,
On Sun, 19 Jul 2026 15:03:00 -0500
Richard Lawrence <rlawrence@tamu.edu> wrote:
> From: Richard Lawrence <rarensu@tamu.edu>
>
> When pasta mode is used to launch an executable (`pasta [COMMAND]`) and that executable accepts inputs in the form of arbitrary file descriptors (such as `bwrap`), then passt should not stand in the way of the parent process handing off those file descriptors to the child process. See bug 204 for additional discussion.
>
> The `pass-fds` option accepts a comma-separated list of file descriptor numbers. `conf_pass_fds()` parses the command line argument, then `isolate_fds()` skips closing the specified fds by calling `close_range()` on the gaps between them.
>
> Additionally, the tap fd is safely relocated to the lowest unused fd number which it at least 3, to avoid accidentally overwriting an existing fd.
Thanks for following up. I haven't had a chance to review this in detail
yet, but it looks significantly simpler than v2.
While I agree with David that the use case should be clearly mentioned
in the commit message (it's not entirely clear to me, either, what
advantage you get by letting pasta spawn a somehow isolated process),
both you and John seem to have the same use case, which I would take as
an indication that there's some actual convenience in this. So, as long
as it's harmless and sufficiently secure, I don't really have anything
against this (except for the pending comments that need to be
addressed).
Another thing I've been discussing offline with David was the
possibility of making pasta spawn the command before closing other open
file descriptors. That would be even simpler, and it should be possible
to do so without any race condition (contrary to what I previously
thought) as the child process waits anyway on a signal from the parent
before proceeding.
So we could leave those files (optionally) open in the child process
taking care of the execvp(), and close them in the parent before
the actual networking setup takes place, and before the command is
spawned, making sure pasta itself has no possible access to any
accidentally leaked file descriptor (which is the security concern
here, we don't really care if the spawned command can access them).
I haven't really thought this through but it might be worth a try and
satisfy your use case anyway, in a simpler way. If that doesn't work
for whatever reason I'm ignoring, let's stick to your approach instead.
I'll review your patch within a couple of days in that case. Sorry for
the delay.
--
Stefano
prev parent reply other threads:[~2026-07-20 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-19 20:03 Richard Lawrence
2026-07-20 3:25 ` David Gibson
2026-07-20 17:44 ` 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=20260720194401.2eb998dd@elisabeth \
--to=sbrivio@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=jbash@jbash.com \
--cc=passt-dev@passt.top \
--cc=rarensu@tamu.edu \
--cc=rlawrence@tamu.edu \
/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).