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]
Date:   Sun, 09 Apr 2017 08:25:18 +0200
From:   Johannes Berg <johannes@...solutions.net>
To:     David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Cc:     xdp-newbies@...r.kernel.org
Subject: Re: [PATCH net-next RFC] Generic XDP

On Sat, 2017-04-08 at 20:07 -0700, David Miller wrote:

> +static int generic_xdp_install(struct net_device *dev, struct
> netdev_xdp *xdp)
> +{
> +       struct bpf_prog *new = xdp->prog;
> +       int ret = 0;
> +
> +       switch (xdp->command) {
> +       case XDP_SETUP_PROG: {
> +               struct bpf_prog *old;
> +
> +               old = xchg(&dev->xdp_prog, new);
> +               if (old)
> +                       bpf_prog_put(old);

I don't really see why you need the xchg() here - just fetching the old
program and setting the new one should be sufficient since you're under
RTNL here.
That would also let you use rcu_assign_pointer() which seems like the
right thing to do here, along with marking the xdp_prog pointer as
__rcu? That'd also let you use rcu_dereference() instead of READ_ONCE()
which seems like the better annotation?

johannes

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ