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]
Date:   Wed, 5 Jan 2022 05:57:27 -0800
From:   Eric Dumazet <edumazet@...gle.com>
To:     Menglong Dong <menglong8.dong@...il.com>
Cc:     Jakub Kicinski <kuba@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        David Miller <davem@...emloft.net>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        David Ahern <dsahern@...nel.org>,
        Shuah Khan <shuah@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>, netdev <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Menglong Dong <imagedong@...cent.com>
Subject: Re: [PATCH v3 net-next 2/2] bpf: selftests: add bind retry for
 post_bind{4, 6}

On Wed, Jan 5, 2022 at 5:21 AM <menglong8.dong@...il.com> wrote:
>
> From: Menglong Dong <imagedong@...cent.com>
>
> With previous patch, kernel is able to 'put_port' after sys_bind()
> fails. Add the test for that case: rebind another port after
> sys_bind() fails. If the bind success, it means previous bind
> operation is already undoed.
>
> Signed-off-by: Menglong Dong <imagedong@...cent.com>
> ---
>  tools/testing/selftests/bpf/test_sock.c | 166 +++++++++++++++++++++---
>  1 file changed, 146 insertions(+), 20 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c
> index e8edd3dd3ec2..68525d68d4e5 100644
> --- a/tools/testing/selftests/bpf/test_sock.c
> +++ b/tools/testing/selftests/bpf/test_sock.c
> @@ -35,12 +35,15 @@ struct sock_test {
>         /* Endpoint to bind() to */
>         const char *ip;
>         unsigned short port;
> +       unsigned short port_retry;
>         /* Expected test result */
>         enum {
>                 LOAD_REJECT,
>                 ATTACH_REJECT,
>                 BIND_REJECT,
>                 SUCCESS,
> +               RETRY_SUCCESS,
> +               RETRY_REJECT
>         } result;
>  };
>
> @@ -60,6 +63,7 @@ static struct sock_test tests[] = {
>                 0,
>                 NULL,
>                 0,
> +               0,
>                 LOAD_REJECT,
>         },


I assume we tried C99 initializers here, and this failed for some reason ?

diff --git a/tools/testing/selftests/bpf/test_sock.c
b/tools/testing/selftests/bpf/test_sock.c
index e8edd3dd3ec2..b57ce9f3eabf 100644
--- a/tools/testing/selftests/bpf/test_sock.c
+++ b/tools/testing/selftests/bpf/test_sock.c
@@ -54,13 +54,13 @@ static struct sock_test tests[] = {
                        BPF_MOV64_IMM(BPF_REG_0, 1),
                        BPF_EXIT_INSN(),
                },
-               BPF_CGROUP_INET4_POST_BIND,
-               BPF_CGROUP_INET4_POST_BIND,
-               0,
-               0,
-               NULL,
-               0,
-               LOAD_REJECT,
+               .expected_attach_type = BPF_CGROUP_INET4_POST_BIND,
+               .attach_type = BPF_CGROUP_INET4_POST_BIND,
+               .domain = 0,
+               .type = 0,
+               .ip = NULL,
+               .port = 0,
+               .result = LOAD_REJECT,
        },
        {
                "bind4 load with invalid access: mark",

Powered by blists - more mailing lists