All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Yuntao Wang <ytcoode@gmail.com>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <kafai@fb.com>,
	"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>, "Shuah Khan" <shuah@kernel.org>,
	"Yucong Sun" <sunyucong@gmail.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Kui-Feng Lee" <kuifeng@fb.com>, "Jiri Olsa" <jolsa@kernel.org>,
	Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Add missing trampoline program type to trampoline_count test
Date: Wed, 18 May 2022 17:04:16 -0700	[thread overview]
Message-ID: <CAEf4BzYr+RZ8A00Yn=Pamt6bk-AmoMyjUHxosgJmrTjkYMhShQ@mail.gmail.com> (raw)
In-Reply-To: <20220515063120.526063-1-ytcoode@gmail.com>

On Sat, May 14, 2022 at 11:31 PM Yuntao Wang <ytcoode@gmail.com> wrote:
>
> Currently the trampoline_count test doesn't include any fmod_ret bpf
> programs, fix it to make the test cover all possible trampoline program
> types.
>
> Since fmod_ret bpf programs can't be attached to __set_task_comm function,
> as it's neither whitelisted for error injection nor a security hook, change
> it to bpf_modify_return_test.
>
> This patch also does some other cleanups such as removing duplicate code,
> dropping inconsistent comments, etc.
>
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> ---
>  include/linux/bpf.h                           |   2 +-
>  .../bpf/prog_tests/trampoline_count.c         | 121 ++++++------------
>  .../bpf/progs/test_trampoline_count.c         |  16 ++-
>  3 files changed, 47 insertions(+), 92 deletions(-)
>

[...]

>
>         /* with E2BIG error */
> -       ASSERT_EQ(err, -E2BIG, "proper error check");
> +       ASSERT_EQ(libbpf_get_error(link), -E2BIG, "E2BIG");
>         ASSERT_EQ(link, NULL, "ptr_is_null");
>
> -       /* and finaly execute the probe */
> -       if (CHECK_FAIL(prctl(PR_GET_NAME, comm, 0L, 0L, 0L)))
> -               goto cleanup_extra;
> -       CHECK_FAIL(test_task_rename());

we stopped testing that kernel function actually can be called
properly, why don't you do bpf_prog_test_run() here to trigger
bpf_modify_return_test in kernel?

> -       CHECK_FAIL(prctl(PR_SET_NAME, comm, 0L, 0L, 0L));
> -
> -cleanup_extra:
> -       bpf_object__close(obj);
>  cleanup:
> -       if (i >= MAX_TRAMP_PROGS)
> -               i = MAX_TRAMP_PROGS - 1;
>         for (; i >= 0; i--) {
> -               bpf_link__destroy(inst[i].link_fentry);
> -               bpf_link__destroy(inst[i].link_fexit);
> +               bpf_link__destroy(inst[i].link);
>                 bpf_object__close(inst[i].obj);
>         }
>  }

[...]

  parent reply	other threads:[~2022-05-19  0:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-15  6:31 [PATCH bpf-next] selftests/bpf: Add missing trampoline program type to trampoline_count test Yuntao Wang
2022-05-17  2:49 ` Yonghong Song
2022-05-19  0:04 ` Andrii Nakryiko [this message]
2022-05-19 15:06   ` [PATCH bpf-next v2] " Yuntao Wang
2022-05-20 23:20     ` 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='CAEf4BzYr+RZ8A00Yn=Pamt6bk-AmoMyjUHxosgJmrTjkYMhShQ@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=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuifeng@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=sunyucong@gmail.com \
    --cc=toke@redhat.com \
    --cc=yhs@fb.com \
    --cc=ytcoode@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.