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: <2f2e522c-b5e1-0c65-147f-f602bca76f18@gmail.com>
Date:   Sun, 1 Mar 2020 20:52:10 -0700
From:   David Ahern <dsahern@...il.com>
To:     Jason Wang <jasowang@...hat.com>, David Ahern <dsahern@...nel.org>,
        netdev@...r.kernel.org
Cc:     davem@...emloft.net, kuba@...nel.org,
        prashantbhole.linux@...il.com, brouer@...hat.com, toke@...hat.com,
        mst@...hat.com, toshiaki.makita1@...il.com, daniel@...earbox.net,
        john.fastabend@...il.com, ast@...nel.org, kafai@...com,
        songliubraving@...com, yhs@...com, andriin@...com,
        David Ahern <dahern@...italocean.com>
Subject: Re: [PATCH RFC v4 bpf-next 07/11] tun: set egress XDP program

On 3/1/20 8:32 PM, Jason Wang wrote:
>> @@ -1189,15 +1190,21 @@ tun_net_get_stats64(struct net_device *dev,
>> struct rtnl_link_stats64 *stats)
>>   }
>>     static int tun_xdp_set(struct net_device *dev, struct bpf_prog *prog,
>> -               struct netlink_ext_ack *extack)
> 
> 
> How about accept a bpf_prog ** here, then there's no need to check
> egress when deferencing the pointer?


sure, that works. Will change.

> 
> 
>> +               bool egress, struct netlink_ext_ack *extack)
>>   {
>>       struct tun_struct *tun = netdev_priv(dev);
>>       struct tun_file *tfile;
>>       struct bpf_prog *old_prog;
>>       int i;
>>   -    old_prog = rtnl_dereference(tun->xdp_prog);
>> -    rcu_assign_pointer(tun->xdp_prog, prog);
>> +    if (egress) {
>> +        old_prog = rtnl_dereference(tun->xdp_egress_prog);
>> +        rcu_assign_pointer(tun->xdp_egress_prog, prog);
>> +    } else {
>> +        old_prog = rtnl_dereference(tun->xdp_prog);
>> +        rcu_assign_pointer(tun->xdp_prog, prog);
>> +    }
>> +
>>       if (old_prog)
>>           bpf_prog_put(old_prog);
> 
> 
> Btw, for egress type of XDP there's no need to toggle SOCK_XDP flag
> which is only needed for RX XDP.

Right. We removed the manipulation of that flag a few iterations ago
based on a review comment.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ