All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf@google.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Jiri Olsa <olsajiri@gmail.com>
Subject: Re: [PATCH bpf-next] selftests/bpf: Mount debugfs in setns_by_fd
Date: Wed, 23 Nov 2022 14:38:52 -0800	[thread overview]
Message-ID: <CAKH8qBt9Fp2q54=EGeLjpyEz2BeZ9zkEmF0z+e4xohejxxwcBw@mail.gmail.com> (raw)
In-Reply-To: <CAADnVQ+dauPf-BhcmM4O7qSqzZFLK2+56N3djzR6zRPB_yawsA@mail.gmail.com>

On Wed, Nov 23, 2022 at 12:39 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Wed, Nov 23, 2022 at 12:08 PM Stanislav Fomichev <sdf@google.com> wrote:
> >
> > Jiri reports broken test_progs after recent commit 68f8e3d4b916
> > ("selftests/bpf: Make sure zero-len skbs aren't redirectable").
> > Apparently we don't remount debugfs when we switch back networking namespace.
> > Let's explicitly mount /sys/kernel/debug.
> >
> > 0: https://lore.kernel.org/bpf/63b85917-a2ea-8e35-620c-808560910819@meta.com/T/#ma66ca9c92e99eee0a25e40f422489b26ee0171c1
> >
> > Fixes: a30338840fa5 ("selftests/bpf: Move open_netns() and close_netns() into network_helpers.c")
> > Reported-by: Jiri Olsa <olsajiri@gmail.com>
> > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > ---
> >  tools/testing/selftests/bpf/network_helpers.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c
> > index bec15558fd93..1f37adff7632 100644
> > --- a/tools/testing/selftests/bpf/network_helpers.c
> > +++ b/tools/testing/selftests/bpf/network_helpers.c
> > @@ -426,6 +426,10 @@ static int setns_by_fd(int nsfd)
> >         if (!ASSERT_OK(err, "mount /sys/fs/bpf"))
> >                 return err;
> >
> > +       err = mount("debugfs", "/sys/kernel/debug", "debugfs", 0, NULL);
> > +       if (!ASSERT_OK(err, "mount /sys/kernel/debug"))
> > +               return err;
> > +
> >         return 0;
> >  }
>
> Thanks.
> It fixes part of it but it's still racy.
> I see:
> do_read:FAIL:open open /sys/fs/bpf/bpf_iter_test1 failed: No such file
> or directory
>
> I suspect it happens when iter tests are running while test_empty_skb
> is cleaning the netns.
>
> So I've added:
> -void test_empty_skb(void)
> +void serial_test_empty_skb(void)
> -void test_xdp_do_redirect(void)
> +void serial_test_xdp_do_redirect(void)
> -void test_xdp_synproxy(void)
> +void serial_test_xdp_synproxy(void)
>
> to stop the bleeding and applied.

Not sure I understand where the race is coming from and no luck
reproducing locally :-(
Looks like we run the tests in the forked workers, so that
unshare(mountns) shouldn't theoretically affect the rest, but
obviously I'm missing something..

  reply	other threads:[~2022-11-23 22:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 20:08 [PATCH bpf-next] selftests/bpf: Mount debugfs in setns_by_fd Stanislav Fomichev
2022-11-23 20:39 ` Alexei Starovoitov
2022-11-23 22:38   ` Stanislav Fomichev [this message]
2022-11-23 23:31     ` Alexei Starovoitov
2022-11-24  0:08       ` Stanislav Fomichev
2022-11-23 20:40 ` patchwork-bot+netdevbpf
2022-11-23 21:21 ` Jiri Olsa

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='CAKH8qBt9Fp2q54=EGeLjpyEz2BeZ9zkEmF0z+e4xohejxxwcBw@mail.gmail.com' \
    --to=sdf@google.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=olsajiri@gmail.com \
    --cc=song@kernel.org \
    --cc=yhs@fb.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.