netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Daan De Meyer <daan.j.demeyer@gmail.com>
Cc: kernel-team@meta.com, netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v5 9/9] selftests/bpf: Add tests for cgroup unix socket address hooks
Date: Fri, 22 Sep 2023 15:04:21 -0700	[thread overview]
Message-ID: <fa7e6c01-87d0-be3a-f4cd-d6d1df4db6c2@linux.dev> (raw)
In-Reply-To: <20230921120913.566702-10-daan.j.demeyer@gmail.com>

On 9/21/23 5:09 AM, Daan De Meyer wrote:
> ---
>   tools/testing/selftests/bpf/bpf_kfuncs.h      |  14 +
>   tools/testing/selftests/bpf/network_helpers.c |  34 ++
>   tools/testing/selftests/bpf/network_helpers.h |   1 +
>   .../selftests/bpf/prog_tests/section_names.c  |  25 +
>   .../selftests/bpf/prog_tests/sock_addr.c      | 570 ++++++++++++++++++
>   .../selftests/bpf/progs/connectun_prog.c      |  40 ++
>   .../selftests/bpf/progs/recvmsgun_prog.c      |  39 ++
>   .../selftests/bpf/progs/sendmsgun_prog.c      |  40 ++
>   8 files changed, 763 insertions(+)
>   create mode 100644 tools/testing/selftests/bpf/prog_tests/sock_addr.c
>   create mode 100644 tools/testing/selftests/bpf/progs/connectun_prog.c
>   create mode 100644 tools/testing/selftests/bpf/progs/recvmsgun_prog.c
>   create mode 100644 tools/testing/selftests/bpf/progs/sendmsgun_prog.c

[ ... ]

> diff --git a/tools/testing/selftests/bpf/prog_tests/sock_addr.c b/tools/testing/selftests/bpf/prog_tests/sock_addr.c
> new file mode 100644
> index 000000000000..f92e5f5fb08d
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/sock_addr.c
> @@ -0,0 +1,570 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <sys/un.h>
> +
> +#include "test_progs.h"
> +
> +#include "connectun_prog.skel.h"
> +#include "sendmsgun_prog.skel.h"
> +#include "recvmsgun_prog.skel.h"
> +#include "getsocknameun_prog.skel.h"
> +#include "getpeernameun_prog.skel.h"

The patch is missing the new getsocknameun_prog.c and getpeernameun_prog.c file.

[ ... ]

> +void test_sock_addr(void)
> +{
> +	int cgroup_fd = -1;
> +	void *skel;
> +
> +	cgroup_fd = test__join_cgroup("/sock_addr");
> +	if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup"))
> +		goto cleanup;
> +
> +	for (size_t i = 0; i < ARRAY_SIZE(tests); ++i) {
> +		struct sock_addr_test *test = &tests[i];
> +
> +		if (!test__start_subtest(test->name))
> +			continue;
> +
> +		skel = test->loadfn(cgroup_fd);
> +		if (!skel)
> +			continue;
> +
> +		switch (test->type) {
> +		case SOCK_ADDR_TEST_BIND:
> +			test_bind(test);

Considering it will help migrating tests from the existing 
"bpf/test_sock_addr.c", don't mind to leave the SOCK_ADDR_TEST_BIND and 
test_bind in this patch even it is not used now. Please mention a few words in 
the commit message and also add a comment here to avoid any future cleanup attempt.

> +			break;
> +		case SOCK_ADDR_TEST_CONNECT:
> +			test_connect(test);
> +			break;
> +		case SOCK_ADDR_TEST_SENDMSG:
> +		case SOCK_ADDR_TEST_RECVMSG:
> +			test_xmsg(test);

It also needs a recvmsg prog test for the connected stream case.


      reply	other threads:[~2023-09-22 22:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 12:09 [PATCH bpf-next v5 0/9] Add cgroup sockaddr hooks for unix sockets Daan De Meyer
2023-09-21 12:09 ` [PATCH bpf-next v5 1/9] selftests/bpf: Add missing section name tests for getpeername/getsockname Daan De Meyer
2023-09-21 12:09 ` [PATCH bpf-next v5 2/9] bpf: Propagate modified uaddrlen from cgroup sockaddr programs Daan De Meyer
2023-09-22  2:59   ` kernel test robot
2023-09-21 12:09 ` [PATCH bpf-next v5 3/9] bpf: Add bpf_sock_addr_set_unix_addr() to allow writing unix sockaddr from bpf Daan De Meyer
2023-09-23  5:19   ` kernel test robot
2023-09-21 12:09 ` [PATCH bpf-next v5 4/9] bpf: Implement cgroup sockaddr hooks for unix sockets Daan De Meyer
2023-09-22 21:18   ` Martin KaFai Lau
2023-09-25 22:12   ` Jordan Rife
2023-09-26  9:54     ` Daan De Meyer
2023-09-26 20:20       ` Jordan Rife
2023-09-21 12:09 ` [PATCH bpf-next v5 5/9] libbpf: Add support for cgroup unix socket address hooks Daan De Meyer
2023-09-21 12:09 ` [PATCH bpf-next v5 6/9] bpftool: " Daan De Meyer
2023-09-25 12:45   ` Quentin Monnet
2023-09-21 12:09 ` [PATCH bpf-next v5 7/9] documentation/bpf: Document " Daan De Meyer
2023-09-21 12:09 ` [PATCH bpf-next v5 8/9] selftests/bpf: Make sure mount directory exists Daan De Meyer
2023-09-21 12:09 ` [PATCH bpf-next v5 9/9] selftests/bpf: Add tests for cgroup unix socket address hooks Daan De Meyer
2023-09-22 22:04   ` Martin KaFai Lau [this message]

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=fa7e6c01-87d0-be3a-f4cd-d6d1df4db6c2@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=daan.j.demeyer@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=netdev@vger.kernel.org \
    /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).