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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa7e6c01-87d0-be3a-f4cd-d6d1df4db6c2@linux.dev>
Date: Fri, 22 Sep 2023 15:04:21 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Daan De Meyer <daan.j.demeyer@...il.com>
Cc: kernel-team@...a.com, netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH bpf-next v5 9/9] selftests/bpf: Add tests for cgroup unix
 socket address hooks

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.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ