Re: [PATCH net] tun, bpf: fix suspicious RCU usage in tun_{attach,detach}_filter
From: Hannes Frederic Sowa <hidden>
Date: 2016-03-31 23:31:57
From: Hannes Frederic Sowa <hidden>
Date: 2016-03-31 23:31:57
Hi Daniel, On 31.03.2016 23:52, Daniel Borkmann wrote:
On 03/31/2016 09:48 PM, Hannes Frederic Sowa wrote: [...]quoted
Tightest solution would probably be to combine both patches. bool called_by_tuntap; old_fp = rcu_dereference_protected(sk->sk_filter, called_by_tuntap ? lockdep_rtnl_is_held() : lockdep_sock_is_held());If I understand you correctly with combining them, you mean you'd still need the API change to pass the bool 'called_by_tuntap' down, right?
I actually decided to simply lock the sockets. So that there will always be a clear lock owner during the updates. I think this is cleaner. What do you think?
If so, your main difference is, after all, to replace the sock_owned_by_user() with the lockdep_sock_is_held() construction instead, correct?
I just didn't do that part because we hold socket lock now.
But then, isn't it already sufficient when you pass the bool itself down that 'demuxes' in this case between the sock_owned_by_user() vs lockdep_rtnl_is_held() check?
I just send out the patches, please have a look. Thanks, Hannes