bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: John Fastabend <john.fastabend@gmail.com>
Cc: Yonghong Song <yhs@fb.com>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Lorenz Bauer <lmb@cloudflare.com>, bpf <bpf@vger.kernel.org>,
	Jakub Sitnicki <jakub@cloudflare.com>,
	Networking <netdev@vger.kernel.org>
Subject: Re: [bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test
Date: Thu, 21 May 2020 12:12:07 -0700	[thread overview]
Message-ID: <CAEf4BzY0Ft8djizeAn3sSZOLfy-ZiH5+AC=ikjk6Uno1U1JgSQ@mail.gmail.com> (raw)
In-Reply-To: <5ec6d1cdbc900_7d832ae77617e5c0ce@john-XPS-13-9370.notmuch>

On Thu, May 21, 2020 at 12:09 PM John Fastabend
<john.fastabend@gmail.com> wrote:
>
> John Fastabend wrote:
> > Andrii Nakryiko wrote:
> > > On Thu, May 21, 2020 at 7:36 AM John Fastabend <john.fastabend@gmail.com> wrote:
> > > >
> > > > The test itself is not particularly useful but it encodes a common
> > > > pattern we have.
> > > >
> > > > Namely do a sk storage lookup then depending on data here decide if
> > > > we need to do more work or alternatively allow packet to PASS. Then
> > > > if we need to do more work consult task_struct for more information
> > > > about the running task. Finally based on this additional information
> > > > drop or pass the data. In this case the suspicious check is not so
> > > > realisitic but it encodes the general pattern and uses the helpers
> > > > so we test the workflow.
> > > >
> > > > This is a load test to ensure verifier correctly handles this case.
> > > >
> > > > Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> > > > ---
>
> [...]
>
> > > > +static void test_skmsg_helpers(enum bpf_map_type map_type)
> > > > +{
> > > > +       struct test_skmsg_load_helpers *skel;
> > > > +       int err, map, verdict;
> > > > +
> > > > +       skel = test_skmsg_load_helpers__open_and_load();
> > > > +       if (!skel) {
> > > > +               FAIL("skeleton open/load failed");
> > > > +               return;
> > > > +       }
> > > > +
> > > > +       verdict = bpf_program__fd(skel->progs.prog_msg_verdict);
> > > > +       map = bpf_map__fd(skel->maps.sock_map);
> > > > +
> > > > +       err = xbpf_prog_attach(verdict, map, BPF_SK_MSG_VERDICT, 0);
> > > > +       if (err)
> > > > +               return;
> > > > +       xbpf_prog_detach2(verdict, map, BPF_SK_MSG_VERDICT);
> > >
> > > no cleanup in this test, at all
> >
> > Guess we need __destroy(skel) here.
> >
> > As an aside how come if the program closes and refcnt drops the entire
> > thing isn't destroyed. I didn't think there was any pinning happening
> > in the __open_and_load piece.
>
> I guess these are in progs_test so we can't leave these around for
> any following tests to trip over. OK. Same thing for patch 3 fwiw.

Yep, exactly. It's a cooperative environment at the moment. We've
talked about running tests in forked processes and in parallel, but
until then, cleaning up is very important.

  reply	other threads:[~2020-05-21 19:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 14:34 [bpf-next PATCH v3 0/5] bpf: Add sk_msg and networking helpers John Fastabend
2020-05-21 14:34 ` [bpf-next PATCH v3 1/5] bpf: sk_msg add some generic helpers that may be useful from sk_msg John Fastabend
2020-05-21 14:35 ` [bpf-next PATCH v3 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task* John Fastabend
2020-05-21 14:35 ` [bpf-next PATCH v3 3/5] bpf: sk_msg add get socket storage helpers John Fastabend
2020-05-21 14:35 ` [bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test John Fastabend
2020-05-21 18:23   ` Yonghong Song
2020-05-21 18:51     ` John Fastabend
2020-05-21 18:51   ` Andrii Nakryiko
2020-05-21 19:03     ` John Fastabend
2020-05-21 19:09       ` John Fastabend
2020-05-21 19:12         ` Andrii Nakryiko [this message]
2020-05-21 14:36 ` [bpf-next PATCH v3 5/5] bpf: selftests, test probe_* helpers from SCHED_CLS John Fastabend
2020-05-21 18:32   ` Yonghong Song
2020-05-21 18:47   ` Andrii Nakryiko
2020-05-21 19:11     ` John Fastabend

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='CAEf4BzY0Ft8djizeAn3sSZOLfy-ZiH5+AC=ikjk6Uno1U1JgSQ@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.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 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 NNTP newsgroup(s).