public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: "Lawrence, Richard E" <rlawrence@tamu.edu>
Cc: "passt-dev@passt.top" <passt-dev@passt.top>
Subject: Re: [PATCH v2] pasta: Add --pass-fds option to skip closing file descriptors
Date: Wed, 28 Oct 2026 21:52:47 +0100 (CET)	[thread overview]
Message-ID: <20261028215246.1b3ff4bc@elisabeth> (raw)
In-Reply-To: <DM3PR11MB8713EDD4284AEF9064BF39ABDA612@DM3PR11MB8713.namprd11.prod.outlook.com>

On Mon, 26 Oct 2026 16:19:41 +0000
"Lawrence, Richard E" <rlawrence@tamu.edu> wrote:

> [...]
>
> I wanted to unconditionally relocate the fd_tap because I imagined
> the following bug: imagine if someone is using pasta, passes the tap
> on stdin, does NOT request to pass fds (tap | pasta -fd 0), and we
> choose not to relocate the tap. Since stdin is never closed, the tap
> would be passed to the spawned command on stdin, which would most
> likely causing the spawned command to have unexpected behavior.

Oh, you're right, I didn't consider that possibility.  I thought that
moving the tap file descriptor would only be relevant if we later close
file descriptors, but that's not actually the case.

I'll review your v3 in a bit.  I just had a glance and I couldn't
figure out right away why the second part of the change in
isolate_fds() isn't a simple:

	if (!c->pasta_pass_fds)
		return;

in the right place (after the --fd descriptor is moved, then), but I
guess I'll figure it out. :)

> Additionally, this choice is especially weird considering that the
> hypothetical user did not even request the tap to be passed to the
> spawned command at all. I would also like to point out that the code
> already unconditionally relocates the tap: I assume that someone must
> have foreseen some other bug (perhaps related to stdin in passt
> mode?) and I don't want to cause a regression in another workflow
> that I don't know anything about.

Your assumption is correct, exactly that, see:

  https://bugs.passt.top/show_bug.cgi?id=215
  https://github.com/libguestfs/libguestfs/issues/360#issuecomment-4939858744

as well as commits:

  c80d9db312df ("main: Ensure fds 0-2 are populated")
  fd5b0807f5d0 ("isolation: Move --fd descriptor to a number of our choosing")

-- 
Stefano


      parent reply	other threads:[~2026-10-28 20:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 15:08 Richard Lawrence
2026-10-25 12:01 ` Stefano Brivio
2026-10-26 16:19   ` Lawrence, Richard E
2026-10-26 17:24     ` Lawrence, Richard E
2026-10-28 20:52     ` 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=20261028215246.1b3ff4bc@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=passt-dev@passt.top \
    --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).