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: <20190628175921.GA979@apalos>
Date:   Fri, 28 Jun 2019 20:59:21 +0300
From:   Ilias Apalodimas <ilias.apalodimas@...aro.org>
To:     Maciej Fijalkowski <maciejromanfijalkowski@...il.com>
Cc:     Jesper Dangaard Brouer <brouer@...hat.com>, netdev@...r.kernel.org,
        jaswinder.singh@...aro.org, ard.biesheuvel@...aro.org,
        bjorn.topel@...el.com, magnus.karlsson@...el.com,
        daniel@...earbox.net, ast@...nel.org,
        makita.toshiaki@....ntt.co.jp, jakub.kicinski@...ronome.com,
        john.fastabend@...il.com, davem@...emloft.net
Subject: Re: [PATCH 3/3, net-next] net: netsec: add XDP support

Hi Maciej,

> > On Fri, Jun 28, 2019 at 03:35:52PM +0200, Jesper Dangaard Brouer wrote:
> > > On Fri, 28 Jun 2019 13:39:15 +0300
> > > Ilias Apalodimas <ilias.apalodimas@...aro.org> wrote:
> > >   
> > > > +static int netsec_xdp_setup(struct netsec_priv *priv, struct bpf_prog *prog,
> > > > +			    struct netlink_ext_ack *extack)
> > > > +{
> > > > +	struct net_device *dev = priv->ndev;
> > > > +	struct bpf_prog *old_prog;
> > > > +
> > > > +	/* For now just support only the usual MTU sized frames */
> > > > +	if (prog && dev->mtu > 1500) {
> > > > +		NL_SET_ERR_MSG_MOD(extack, "Jumbo frames not supported on XDP");
> > > > +		return -EOPNOTSUPP;
> > > > +	}
> > > > +
> > > > +	if (netif_running(dev))
> > > > +		netsec_netdev_stop(dev);
> > > > +
> > > > +	/* Detach old prog, if any */
> > > > +	old_prog = xchg(&priv->xdp_prog, prog);
> > > > +	if (old_prog)
> > > > +		bpf_prog_put(old_prog);
> > > > +
> > > > +	if (netif_running(dev))
> > > > +		netsec_netdev_open(dev);  
> > > 
> > > Shouldn't the if-statement be if (!netif_running(dev))
> > >   
> > > > +  
> > This is there to restart the device if it's up already (to rebuild the rings).
> > This should be fine as-is
> 
> I think that Jesper's concern was about that you could have already stopped the
> netdev earlier via netsec_netdev_stop (before the xchg)? So at this point
> __LINK_STATE_START might be not set.
> 
> Maybe initially store what netif_running(dev) returns in stack variable and
> act on it, so your stop/open are symmetric?
I did not write the open/close originally but to my understanding, 
netsec_netdev_stop() won't change that the .ndo_close will. 
So this check is there to ensure a user won't bring the interface down during 
loading/re-loading of the program. Keeping in the stack would break that,
wouldn't it?

Thanks
/Ilias

> 
> > 
> > > > +	return 0;
> > > > +}  
> > 
> > Thanks
> > /Ilias
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ