All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Subject: Re: [PATCH bpf-next v2 3/4] selftests/bpf: Add negative C tests for kptrs
Date: Wed, 11 May 2022 20:08:16 -0700	[thread overview]
Message-ID: <CAEf4BzZm2rVt3Xxahah4cDur3o1LtUU399KYe5+ZzOaDck+cGA@mail.gmail.com> (raw)
In-Reply-To: <20220511194654.765705-4-memxor@gmail.com>

On Wed, May 11, 2022 at 12:46 PM Kumar Kartikeya Dwivedi
<memxor@gmail.com> wrote:
>
> This uses the newly added SEC("?foo") naming to disable autoload of
> programs, and then loads them one by one for the object and verifies
> that loading fails and matches the returned error string from verifier.
> This is similar to already existing verifier tests but provides coverage
> for BPF C.
>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> ---
>  .../selftests/bpf/prog_tests/map_kptr.c       |  87 +++-
>  .../selftests/bpf/progs/map_kptr_fail.c       | 418 ++++++++++++++++++
>  2 files changed, 504 insertions(+), 1 deletion(-)
>  create mode 100644 tools/testing/selftests/bpf/progs/map_kptr_fail.c
>

[...]

> +
> +static void test_map_kptr_success(void)
>  {
>         struct map_kptr *skel;
>         int key = 0, ret;
> @@ -35,3 +113,10 @@ void test_map_kptr(void)
>
>         map_kptr__destroy(skel);
>  }
> +
> +void test_map_kptr(void)
> +{
> +       if (test__start_subtest("success"))
> +               test_map_kptr_success();
> +       test_map_kptr_fail();

I think the intent for this was to be another subtest, right? Worth
fixing in a follow up?

> +}
> diff --git a/tools/testing/selftests/bpf/progs/map_kptr_fail.c b/tools/testing/selftests/bpf/progs/map_kptr_fail.c
> new file mode 100644
> index 000000000000..05e209b1b12a
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/map_kptr_fail.c
> @@ -0,0 +1,418 @@

[...]

  reply	other threads:[~2022-05-12  3:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11 19:46 [PATCH bpf-next v2 0/4] Follow ups for kptr series Kumar Kartikeya Dwivedi
2022-05-11 19:46 ` [PATCH bpf-next v2 1/4] bpf: Fix sparse warning for bpf_kptr_xchg_proto Kumar Kartikeya Dwivedi
2022-05-11 19:46 ` [PATCH bpf-next v2 2/4] bpf: Prepare prog_test_struct kfuncs for runtime tests Kumar Kartikeya Dwivedi
2022-05-11 19:46 ` [PATCH bpf-next v2 3/4] selftests/bpf: Add negative C tests for kptrs Kumar Kartikeya Dwivedi
2022-05-12  3:08   ` Andrii Nakryiko [this message]
2022-05-12 23:58     ` Kumar Kartikeya Dwivedi
2022-05-13  0:10       ` Andrii Nakryiko
2022-05-11 19:46 ` [PATCH bpf-next v2 4/4] selftests/bpf: Add tests for kptr_ref refcounting Kumar Kartikeya Dwivedi
2022-05-12  0:20 ` [PATCH bpf-next v2 0/4] Follow ups for kptr series patchwork-bot+netdevbpf

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=CAEf4BzZm2rVt3Xxahah4cDur3o1LtUU399KYe5+ZzOaDck+cGA@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=memxor@gmail.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.