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: <CAADnVQLz0ojicbKS4LSjCCb5yaK9xKzB0MEJNYzb+Z6bVAFt4g@mail.gmail.com>
Date:   Fri, 17 Jul 2020 09:16:27 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Cc:     Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>, bpf <bpf@...r.kernel.org>,
        Network Development <netdev@...r.kernel.org>,
        Björn Töpel <bjorn.topel@...el.com>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>
Subject: Re: [PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall
 handling in JIT

On Fri, Jul 17, 2020 at 4:02 AM Maciej Fijalkowski
<maciej.fijalkowski@...el.com> wrote:
>
> On Thu, Jul 16, 2020 at 07:16:24PM -0700, Alexei Starovoitov wrote:
> > On Fri, Jul 17, 2020 at 01:06:07AM +0200, Daniel Borkmann wrote:
> > > > +                         ret = bpf_arch_text_poke(poke->tailcall_bypass,
> > > > +                                                  BPF_MOD_JUMP,
> > > > +                                                  NULL, bypass_addr);
> > > > +                         BUG_ON(ret < 0 && ret != -EINVAL);
> > > > +                         /* let other CPUs finish the execution of program
> > > > +                          * so that it will not possible to expose them
> > > > +                          * to invalid nop, stack unwind, nop state
> > > > +                          */
> > > > +                         synchronize_rcu();
> > >
> > > Very heavyweight that we need to potentially call this /multiple/ times for just a
> > > /single/ map update under poke mutex even ... but agree it's needed here to avoid
> > > racing. :(
> >
> > Yeah. I wasn't clear with my suggestion earlier.
> > I meant to say that synchronize_rcu() can be done between two loops.
> > list_for_each_entry(elem, &aux->poke_progs, list)
> >    for (i = 0; i < elem->aux->size_poke_tab; i++)
> >         bpf_arch_text_poke(poke->tailcall_bypass, ...
> > synchronize_rcu();
> > list_for_each_entry(elem, &aux->poke_progs, list)
> >    for (i = 0; i < elem->aux->size_poke_tab; i++)
> >         bpf_arch_text_poke(poke->poke->tailcall_target, ...
> >
> > Not sure how much better it will be though.
> > text_poke is heavy.
> > I think it's heavier than synchronize_rcu().
> > Long term we can do batch of text_poke-s.
>
> Yeah since we introduce another poke target we could come up with
> preparing the vector of pokes as you're saying?

yes. eventually. Pls keep it simple for now.
The logic is already quite complex.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ