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: <874l8h3aw8.fsf@toke.dk>
Date:   Tue, 05 Mar 2019 10:53:27 +0100
From:   Toke Høiland-Jørgensen <toke@...hat.com>
To:     Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc:     David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>
Subject: Re: [PATCH net-next v3 2/3] xdp: Always use a devmap for XDP_REDIRECT to a device

Jakub Kicinski <jakub.kicinski@...ronome.com> writes:

> On Mon, 04 Mar 2019 23:28:14 +0100, Toke Høiland-Jørgensen wrote:
>> Jakub Kicinski <jakub.kicinski@...ronome.com> writes:
>> > On Mon, 04 Mar 2019 20:05:30 +0100, Toke Høiland-Jørgensen wrote:  
>> >> > Hm.  I think you'll still need a lock (mutex?) on the alloc path, but
>> >> > the free path should be fine as long as you load the map pointer before
>> >> > looking at the refcnt (atomic op ensuring the barrier there).    
>> >> 
>> >> Yeah, for the per-namespace refcnt it's pretty straight forward, the
>> >> trouble is the global count that needs to iterate over all namespaces;
>> >> probably need to put that all behind a (non-spin)lock, right?  
>> >
>> > Because net iteration is under RCU? You can switch to taking net_rwsem
>> > for that one, no? I'm probably confused again ;)  
>> 
>> Because there's a single refcount that needs to trigger
>> creation/deletion of *all* the default maps. I.e.
>> 
>> if (atomic_dec_return(&global_refcnt))
>>   for_each_namespace(net)
>>     destroy_default_map(net);
>> 
>> which needs to not step on the toes of a subsequent
>> 
>> if (atomic_inc_return(&global_refcnt) == 1)
>>   for_each_namespace(net)
>>     create_default_map(net);
>> 
>> (or vice versa, of course).
>> 
>> Not sure there's a way to do that without wrapping both of those
>> constructs (including the refcnt inc/dec) in a mutex?
>
> Seems like it :(

Right. Well I'm glad that we at least agree, so I can stop racking my
brain for other ways to do it ;)

-Toke

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ