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] [day] [month] [year] [list]
Message-ID: <CAADnVQKPmUxv6or76-KBVtaD2i+aRpX_qKxr1v7cwdOhWH6QLQ@mail.gmail.com>
Date:   Mon, 24 Jul 2023 11:04:03 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Mahmoud Maatuq <mahmoudmatook.mm@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <martin.lau@...ux.dev>,
        Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Stanislav Fomichev <sdf@...gle.com>,
        Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
        Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
        bpf <bpf@...r.kernel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] selftests/bpf: fix build errors if CONFIG_NF_CONNTRACK_MARK
 not set.

On Sun, Jul 23, 2023 at 2:38 AM Mahmoud Maatuq
<mahmoudmatook.mm@...il.com> wrote:
>
> 'mark' member in 'struct nf_conn' is conditionally defined
>  by CONFIG_NF_CONNTRACK_MARK
>  so any reference to it should follow the same.
>
>  $ make -C tools/testing/selftests/bpf
>         progs/test_bpf_nf.c:219:12: error: no member named 'mark' in 'struct nf_conn'
>                                 if (ct->mark == 42) {
>                                     ~~  ^
>         progs/test_bpf_nf.c:220:9: error: no member named 'mark' in 'struct nf_conn'
>                                         ct->mark++;
>                                         ~~  ^
>         progs/test_bpf_nf.c:221:34: error: no member named 'mark' in 'struct nf_conn'
>                                 test_exist_lookup_mark = ct->mark;
>
> Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@...il.com>
> ---
>  .../testing/selftests/bpf/progs/test_bpf_nf.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_bpf_nf.c b/tools/testing/selftests/bpf/progs/test_bpf_nf.c
> index 77ad8adf68da..0b285de8b7e7 100644
> --- a/tools/testing/selftests/bpf/progs/test_bpf_nf.c
> +++ b/tools/testing/selftests/bpf/progs/test_bpf_nf.c
> @@ -157,7 +157,10 @@ nf_ct_test(struct nf_conn *(*lookup_fn)(void *, struct bpf_sock_tuple *, u32,
>                 struct nf_conn *ct_ins;
>
>                 bpf_ct_set_timeout(ct, 10000);
> -               ct->mark = 77;
> +               #if defined(CONFIG_NF_CONNTRACK_MARK)
> +                       ct->mark = 77;
> +               #endif
> +
>
>                 /* snat */
>                 saddr.ip = bpf_get_prandom_u32();
> @@ -188,7 +191,9 @@ nf_ct_test(struct nf_conn *(*lookup_fn)(void *, struct bpf_sock_tuple *, u32,
>                                 bpf_ct_change_timeout(ct_lk, 10000);
>                                 test_delta_timeout = ct_lk->timeout - bpf_jiffies64();
>                                 test_delta_timeout /= CONFIG_HZ;
> -                               test_insert_lookup_mark = ct_lk->mark;
> +                               #if defined(CONFIG_NF_CONNTRACK_MARK)
> +                                       test_insert_lookup_mark = ct_lk->mark;
> +                               #endif
>                                 bpf_ct_change_status(ct_lk,
>                                                      IPS_CONFIRMED | IPS_SEEN_REPLY);
>                                 test_status = ct_lk->status;
> @@ -210,10 +215,12 @@ nf_ct_test(struct nf_conn *(*lookup_fn)(void *, struct bpf_sock_tuple *, u32,
>                        sizeof(opts_def));
>         if (ct) {
>                 test_exist_lookup = 0;
> -               if (ct->mark == 42) {
> -                       ct->mark++;
> -                       test_exist_lookup_mark = ct->mark;
> -               }
> +               #if defined(CONFIG_NF_CONNTRACK_MARK)
> +                       if (ct->mark == 42) {
> +                               ct->mark++;
> +                               test_exist_lookup_mark = ct->mark;
> +                       }
> +               #endif

That's not a fix.
The test has to have CONFIG_NF_CONNTRACK_MARK enabled in the kernel.
Make sure your kernel is built with _all_ configs specified in
tools/testing/selftests/bpf/config*

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ