lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 17 Oct 2019 12:13:38 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Martin Lau <kafai@...com>
Cc:     Jakub Sitnicki <jakub@...udflare.com>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "kernel-team@...udflare.com" <kernel-team@...udflare.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andriin@...com>
Subject: Re: [PATCH bpf-next] selftests/bpf: Restore the netns after flow
 dissector reattach test

On Thu, Oct 17, 2019 at 11:18 AM Martin Lau <kafai@...com> wrote:
>
> On Thu, Oct 17, 2019 at 10:37:52AM +0200, Jakub Sitnicki wrote:
> > flow_dissector_reattach test changes the netns we run in but does not
> > restore it to the one we started in when finished. This interferes with
> > tests that run after it. Fix it by restoring the netns when done.
> >
> > Fixes: f97eea1756f3 ("selftests/bpf: Check that flow dissector can be re-attached")
> > Reported-by: Alexei Starovoitov <ast@...nel.org>
> > Reported-by: Andrii Nakryiko <andriin@...com>
> > Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
> > ---
> >  .../bpf/prog_tests/flow_dissector_reattach.c  | 21 +++++++++++++++----
> >  1 file changed, 17 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c b/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
> > index 777faffc4639..1f51ba66b98b 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
> > @@ -91,12 +91,18 @@ static void do_flow_dissector_reattach(void)
> >
> >  void test_flow_dissector_reattach(void)
> >  {
> > -     int init_net, err;
> > +     int init_net, self_net, err;
> > +
> > +     self_net = open("/proc/self/ns/net", O_RDONLY);
> > +     if (CHECK_FAIL(self_net < 0)) {
> > +             perror("open(/proc/self/ns/net");
> > +             return;
> > +     }
> >
> >       init_net = open("/proc/1/ns/net", O_RDONLY);
> >       if (CHECK_FAIL(init_net < 0)) {
> >               perror("open(/proc/1/ns/net)");
> > -             return;
> > +             goto out_close;
> Mostly nit.  close(-1) is ok-ish...  The same goes for the "out_close" in
> do_flow_dissector_reattach().
>
> Acked-by: Martin KaFai Lau <kafai@...com>

Yeah. Not ideal, but applied the fix to bpf-next
to get selftests working again.
Please follow up with any cleanups.
Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ