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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 14 Jan 2021 19:57:14 -0800
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Stanislav Fomichev <sdf@...gle.com>
Cc:     Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH bpf-next v8 1/3] bpf: remove extra lock_sock for TCP_ZEROCOPY_RECEIVE

On Thu, Jan 14, 2021 at 7:40 PM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> On Thu, Jan 14, 2021 at 7:27 PM Alexei Starovoitov
> <alexei.starovoitov@...il.com> wrote:
> >
> > On Wed, Jan 13, 2021 at 1:33 PM Stanislav Fomichev <sdf@...gle.com> wrote:
> > >
> > > Add custom implementation of getsockopt hook for TCP_ZEROCOPY_RECEIVE.
> > > We skip generic hooks for TCP_ZEROCOPY_RECEIVE and have a custom
> > > call in do_tcp_getsockopt using the on-stack data. This removes
> > > 3% overhead for locking/unlocking the socket.
> > >
> > > Without this patch:
> > >      3.38%     0.07%  tcp_mmap  [kernel.kallsyms]  [k] __cgroup_bpf_run_filter_getsockopt
> > >             |
> > >              --3.30%--__cgroup_bpf_run_filter_getsockopt
> > >                        |
> > >                         --0.81%--__kmalloc
> > >
> > > With the patch applied:
> > >      0.52%     0.12%  tcp_mmap  [kernel.kallsyms]  [k] __cgroup_bpf_run_filter_getsockopt_kern
> > >
> > > Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> > > Cc: Martin KaFai Lau <kafai@...com>
> > > Cc: Song Liu <songliubraving@...com>
> > > Cc: Eric Dumazet <edumazet@...gle.com>
> > > Acked-by: Martin KaFai Lau <kafai@...com>
> >
> > Few issues in this patch and the patch 2 doesn't apply:
> > Switched to a new branch 'tmp'
> > Applying: bpf: Remove extra lock_sock for TCP_ZEROCOPY_RECEIVE
> > .git/rebase-apply/patch:295: trailing whitespace.
> > #endif
> > .git/rebase-apply/patch:306: trailing whitespace.
> > union tcp_word_hdr {
> > .git/rebase-apply/patch:309: trailing whitespace.
> > };
> > .git/rebase-apply/patch:311: trailing whitespace.
> > #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
> > .git/rebase-apply/patch:313: trailing whitespace.
> > enum {
> > warning: squelched 1 whitespace error
> > warning: 6 lines add whitespace errors.
> > Applying: bpf: Try to avoid kzalloc in cgroup/{s,g}etsockopt
> > error: patch failed: kernel/bpf/cgroup.c:1390
> > error: kernel/bpf/cgroup.c: patch does not apply
> > Patch failed at 0002 bpf: Try to avoid kzalloc in cgroup/{s,g}etsockopt
> Sorry, I mentioned in the cover letter that the series requires
> 4be34f3d0731 ("bpf: Don't leak memory in bpf getsockopt when optlen == 0")
> which is only in the bpf tree. No sure when bpf & bpf-next merge.
> Or are you trying to apply on top of that?

hmm. It will take a while to wait for the trees to converge.
Ok. I've cherry-picked that bpf commit and applied 3 patches on top,
but the test failed to build:

progs/sockopt_sk.c:60:47: error: use of undeclared identifier
'TCP_ZEROCOPY_RECEIVE'
        if (ctx->level == SOL_TCP && ctx->optname == TCP_ZEROCOPY_RECEIVE) {
                                                     ^
progs/sockopt_sk.c:66:16: error: invalid application of 'sizeof' to an
incomplete type 'struct tcp_zerocopy_receive'
                if (optval + sizeof(struct tcp_zerocopy_receive) > optval_end)

Looks like copied uapi/tcp.h into tools/ wasn't in the include path.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ