lkml.org 
[lkml]   [2017]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next V2 3/3] tun: add eBPF based queue selection method
On Wed, Nov 01, 2017 at 09:02:03PM +0800, Jason Wang wrote:
>
>
> On 2017年11月01日 00:45, Michael S. Tsirkin wrote:
> > > +static void __tun_set_steering_ebpf(struct tun_struct *tun,
> > > + struct bpf_prog *new)
> > > +{
> > > + struct bpf_prog *old;
> > > +
> > > + old = rtnl_dereference(tun->steering_prog);
> > > + rcu_assign_pointer(tun->steering_prog, new);
> > > +
> > > + if (old) {
> > > + synchronize_net();
> > > + bpf_prog_destroy(old);
> > > + }
> > > +}
> > > +
> > Is this really called under rtnl?
>
> Yes it is __tun_chr_ioctl() will call rtnl_lock().

Is the call from tun_free_netdev under rtnl too?

> > If no then rtnl_dereference
> > is wrong. If yes I'm not sure you can call synchronize_net
> > under rtnl.
> >
>
> Are you worrying about the long wait? Looking at synchronize_net(), it does:
>
> void synchronize_net(void)
> {
>     might_sleep();
>     if (rtnl_is_locked())
>         synchronize_rcu_expedited();
>     else
>         synchronize_rcu();
> }
> EXPORT_SYMBOL(synchronize_net);
>
> Thanks

Not the wait - expedited is not a good thing to allow unpriveledged
userspace to do, it interrupts all VMs running on the same box.

We could use a callback though the docs warn userspace can use that
to cause a DOS and needs to be limited.


--
MST

\
 
 \ /
  Last update: 2017-11-01 15:00    [W:0.590 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site