public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] pasta: Workaround: wait for execvp() to be done in child before entering netns
Date: Mon, 7 Nov 2022 19:40:11 +0100	[thread overview]
Message-ID: <20221107194011.30d09bac@elisabeth> (raw)
In-Reply-To: <20221107105111.09af5336@elisabeth>

On Mon, 7 Nov 2022 10:51:11 +0100
Stefano Brivio <sbrivio@redhat.com> wrote:

> On Mon, 7 Nov 2022 14:17:44 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > On Fri, Nov 04, 2022 at 02:53:28AM +0100, Stefano Brivio wrote:  
> > > This happens about every third time on the two_guests/basic test, and
> > > on that test only: we clone() twice, first to spawn a child, then to
> > > spawn a thread to check that we can enter the target network
> > > namespace.
> > > 
> > > In this thread, we open a file descriptor associated to the target
> > > namespace. It might happen that it doesn't exist yet: the kernel can
> > > legitimately take its time to create one, after clone(). In this
> > > case, at least on a 5.15 Linux kernel, trying to open that file again
> > > always yields EACCES, and we get stuck there.
> > > 
> > > This only occurs if we spawn two instances of pasta very close
> > > together, as it's done in the two_guests/basic case.
> > > 
> > > I couldn't figure out what the race condition is, yet, and especially
> > > if it's a kernel issue or something we're doing wrong. However, if we
> > > wait until the execvp() in the child is done, the issue disappears.
> > > I'm not sure yet if it's just because of timing and this is hiding an
> > > unrelated race condition.
> > > 
> > > The workaround consists of checking /proc/PID/exe against our own. If
> > > it's different, that means execvp() already completed and we can
> > > proceed. It's rather ugly, but much better than the alternative.
> > > Leave a FIXME there for the moment being.
> > > 
> > > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>    
> > 
> > Weird and ugly, but seems like we need it.
> > 
> > Reviewed-by: David Gibson <david@gibson.dropbear.id.au>  
> 
> Sorry, I forgot to mention: I didn't actually push this, because while
> repeating that test over and over again I hit the same failure at some
> point, even with this trick.
> 
> So this is probably just affecting the timing. I need to look into it
> again.

Tracked at:
  https://bugs.passt.top/show_bug.cgi?id=36

for the moment being.

-- 
Stefano


      reply	other threads:[~2022-11-07 18:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04  1:53 [PATCH] pasta: Workaround: wait for execvp() to be done in child before entering netns Stefano Brivio
2022-11-07  3:17 ` David Gibson
2022-11-07  9:51   ` Stefano Brivio
2022-11-07 18:40     ` 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=20221107194011.30d09bac@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /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).