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]
Date:   Tue, 16 Aug 2022 22:23:57 -0700
From:   Martin KaFai Lau <kafai@...com>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     sdf@...gle.com, bpf@...r.kernel.org, netdev@...r.kernel.org,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        David Miller <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>, kernel-team@...com,
        Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH v3 bpf-next 00/15] bpf: net: Remove duplicated code from
 bpf_setsockopt()

On Tue, Aug 16, 2022 at 12:04:52AM +0200, Daniel Borkmann wrote:
> On 8/11/22 7:04 PM, sdf@...gle.com wrote:
> > On 08/10, Martin KaFai Lau wrote:
> > > The code in bpf_setsockopt() is mostly a copy-and-paste from
> > > the sock_setsockopt(), do_tcp_setsockopt(), do_ipv6_setsockopt(),
> > > and do_ip_setsockopt().  As the allowed optnames in bpf_setsockopt()
> > > grows, so are the duplicated code.  The code between the copies
> > > also slowly drifted.
> > 
> > > This set is an effort to clean this up and reuse the existing
> > > {sock,do_tcp,do_ipv6,do_ip}_setsockopt() as much as possible.
> > 
> > > After the clean up, this set also adds a few allowed optnames
> > > that we need to the bpf_setsockopt().
> > 
> > > The initial attempt was to clean up both bpf_setsockopt() and
> > > bpf_getsockopt() together.  However, the patch set was getting
> > > too long.  It is beneficial to leave the bpf_getsockopt()
> > > out for another patch set.  Thus, this set is focusing
> > > on the bpf_setsockopt().
> > 
> > > v3:
> > > - s/in_bpf/has_current_bpf_ctx/ (Andrii)
> > > - Add comments to has_current_bpf_ctx() and sockopt_lock_sock()
> > >    (Stanislav)
> > > - Use vmlinux.h in selftest and add defines to bpf_tracing_net.h
> > >    (Stanislav)
> > > - Use bpf_getsockopt(SO_MARK) in selftest (Stanislav)
> > > - Use BPF_CORE_READ_BITFIELD in selftest (Yonghong)
> > 
> > Reviewed-by: Stanislav Fomichev <sdf@...gle.com>
> > 
> > (I didn't go super deep on the selftest)
> 
> Looks like that one throws a build error, fwiw:
> 
> https://github.com/kernel-patches/bpf/runs/7844497492?check_suite_focus=true
> 
>   [...]
>     CLNG-BPF [test_maps] kfunc_call_test_subprog.o
>     CLNG-BPF [test_maps] bpf_iter_test_kern6.o
>   progs/setget_sockopt.c:39:33: error: implicit truncation from 'int' to bit-field changes value from 1 to -1 [-Werror,-Wbitfield-constant-conversion]
>           { .opt = SO_REUSEADDR, .flip = 1, },
>                                          ^
>   progs/setget_sockopt.c:42:33: error: implicit truncation from 'int' to bit-field changes value from 1 to -1 [-Werror,-Wbitfield-constant-conversion]
>           { .opt = SO_KEEPALIVE, .flip = 1, },
>                                          ^
>   progs/setget_sockopt.c:44:33: error: implicit truncation from 'int' to bit-field changes value from 1 to -1 [-Werror,-Wbitfield-constant-conversion]
>           { .opt = SO_REUSEPORT, .flip = 1, },
>                                          ^
>     CLNG-BPF [test_maps] btf__core_reloc_type_id.o
>   progs/setget_sockopt.c:48:32: error: implicit truncation from 'int' to bit-field changes value from 1 to -1 [-Werror,-Wbitfield-constant-conversion]
>           { .opt = SO_TXREHASH, .flip = 1, },
>                                         ^
>   progs/setget_sockopt.c:53:32: error: implicit truncation from 'int' to bit-field changes value from 1 to -1 [-Werror,-Wbitfield-constant-conversion]
>           { .opt = TCP_NODELAY, .flip = 1, },
>                                         ^
>   progs/setget_sockopt.c:61:45: error: implicit truncation from 'int' to bit-field changes value from 1 to -1 [-Werror,-Wbitfield-constant-conversion]
>           { .opt = TCP_THIN_LINEAR_TIMEOUTS, .flip = 1, },
>                                                      ^
>   progs/setget_sockopt.c:75:39: error: implicit truncation from 'int' to bit-field changes value from 1 to -1 [-Werror,-Wbitfield-constant-conversion]
>           { .opt = IPV6_AUTOFLOWLABEL, .flip = 1, },
>                                                ^
>   7 errors generated.
>   make: *** [Makefile:521: /tmp/runner/work/bpf/bpf/tools/testing/selftests/bpf/setget_sockopt.o] Error 1
>   make: *** Waiting for unfinished jobs....
>   make: Leaving directory '/tmp/runner/work/bpf/bpf/tools/testing/selftests/bpf'
>   Error: Process completed with exit code 2.
Thanks for the report.  I also see it after moving from clang 15 to 16.
I will address it in v4.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ