public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion•org>
To: Alexei Starovoitov <alexei.starovoitov@gmail•com>,
	Michal Kubecek <mkubecek@suse•cz>
Cc: Daniel Borkmann <daniel@iogearbox•net>,
	davem@davemloft•net, sasha.levin@oracle•com, jslaby@suse•cz,
	eric.dumazet@gmail•com, mst@redhat•com, netdev@vger•kernel.org
Subject: Re: [PATCH net] tun, bpf: fix suspicious RCU usage in tun_{attach,detach}_filter
Date: Thu, 31 Mar 2016 14:12:18 +0200	[thread overview]
Message-ID: <56FD1422.9030903@stressinduktion.org> (raw)
In-Reply-To: <20160331054301.GA57227@ast-mbp.thefacebook.com>

On 31.03.2016 07:43, Alexei Starovoitov wrote:
> On Thu, Mar 31, 2016 at 07:22:32AM +0200, Michal Kubecek wrote:
>> On Wed, Mar 30, 2016 at 10:08:10PM -0700, Alexei Starovoitov wrote:
>>> On Thu, Mar 31, 2016 at 07:01:15AM +0200, Michal Kubecek wrote:
>>>> On Wed, Mar 30, 2016 at 06:18:42PM -0700, Alexei Starovoitov wrote:
>>>>>
>>>>> kinda heavy patch to shut up lockdep.
>>>>> Can we do
>>>>> old_fp = rcu_dereference_protected(sk->sk_filter,
>>>>>                                  sock_owned_by_user(sk) || lockdep_rtnl_is_held());
>>>>> and it always be correct?
>>>>> I think right now tun is the only such user, but if it's correct
>>>>> for tun, it's correct for future users too. If not correct then
>>>>> not correct for tun either.
>>>>> Or I'm missing something?
>>>>
>>>> Already discussed here:
>>>>
>>>>    http://thread.gmane.org/gmane.linux.kernel/2158069/focus=405853
>>>
>>> I saw that. My point above was challenging 'less accurate' part.
>>>
>> Daniel's point was that lockdep_rtnl_is_held() does not mean "we hold
>> RTNL" but "someone holds RTNL" so that some other task holding RTNL at
>> the moment could make the check happy even when called by someone
>> supposed to own the socket.
>
> Of course... and that is the case for all rtnl_dereference() calls...
> yet we're not paranoid about it.

lockdep_rtnl_is_held actually checks *current if the currently running 
code actually has the lock, no?

Bye,
Hannes

  parent reply	other threads:[~2016-03-31 12:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31  0:13 [PATCH net] tun, bpf: fix suspicious RCU usage in tun_{attach,detach}_filter Daniel Borkmann
2016-03-31  1:18 ` Alexei Starovoitov
2016-03-31  5:01   ` Michal Kubecek
2016-03-31  5:08     ` Alexei Starovoitov
2016-03-31  5:22       ` Michal Kubecek
2016-03-31  5:43         ` Alexei Starovoitov
2016-03-31 11:35           ` Daniel Borkmann
2016-03-31 11:59             ` Eric Dumazet
2016-03-31 12:16               ` Daniel Borkmann
2016-03-31 19:21                 ` David Miller
2016-03-31 19:24                   ` Hannes Frederic Sowa
2016-03-31 19:31                     ` Alexei Starovoitov
2016-03-31 19:48                       ` David Miller
2016-03-31 19:36                     ` David Miller
2016-03-31 19:48                       ` Hannes Frederic Sowa
2016-03-31 19:50                         ` David Miller
2016-03-31 21:52                         ` Daniel Borkmann
2016-03-31 23:31                           ` Hannes Frederic Sowa
2016-03-31 12:12           ` Hannes Frederic Sowa [this message]
2016-03-31  9:15 ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56FD1422.9030903@stressinduktion.org \
    --to=hannes@stressinduktion$(echo .)org \
    --cc=alexei.starovoitov@gmail$(echo .)com \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=eric.dumazet@gmail$(echo .)com \
    --cc=jslaby@suse$(echo .)cz \
    --cc=mkubecek@suse$(echo .)cz \
    --cc=mst@redhat$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sasha.levin@oracle$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox