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]
Message-ID: <20200717105744.GB11239@ranger.igk.intel.com>
Date:   Fri, 17 Jul 2020 12:57:44 +0200
From:   Maciej Fijalkowski <maciej.fijalkowski@...el.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     Daniel Borkmann <daniel@...earbox.net>, ast@...nel.org,
        bpf@...r.kernel.org, netdev@...r.kernel.org, bjorn.topel@...el.com,
        magnus.karlsson@...el.com
Subject: Re: [PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall
 handling in JIT

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?

> 
> I'm actually fine with above approach of synchronize_rcu() without splitting the loop.
> This kind of optimizations can be done later as a follow up.
> I'd really like to land this stuff in this bpf-next cycle.
> It's a big improvement to tail_calls and bpf2bpf calls.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ