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, 12 Jan 2014 22:36:41 -0800
From:	Cong Wang <cwang@...pensource.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Tom Herbert <therbert@...gle.com>, netdev <netdev@...r.kernel.org>
Subject: Re: suspicious RCU usage in net/ipv4/ip_tunnel.c:80

On Sun, Jan 12, 2014 at 9:44 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> On Sat, 2014-01-11 at 11:15 -0800, Cong Wang wrote:
>> On Fri, Jan 10, 2014 at 5:21 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
>> >
>> > Nope, the synchronize_rcu() is not needed here.
>>
>> OK.
>>
>> >
>> > Please use following sparse ready patch, thanks :
>> >
>> > diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
>> > index d3929a69f008..6eda759b5c4b 100644
>> > --- a/net/ipv4/ip_tunnel.c
>> > +++ b/net/ipv4/ip_tunnel.c
>> > @@ -77,10 +77,11 @@ static inline void __tunnel_dst_set(struct ip_tunnel_dst *idst,
>> >                 dst = NULL;
>> >
>> >         spin_lock_bh(&idst->lock);
>> > -       old_dst = rcu_dereference(idst->dst);
>> > +       old_dst = rcu_dereference_protected(idst->dst,
>> > +                                           lockdep_is_held(&idst->lock));
>> >         rcu_assign_pointer(idst->dst, dst);
>> > -       dst_release(old_dst);
>> >         spin_unlock_bh(&idst->lock);
>> > +       dst_release(old_dst);
>>
>> Do you really need a rcu_dereference*() here? We don't dereference
>> it inside spin_lock protection.
>
> Please read rcu_dereference_protected() documentation in
> include/linux/rcupdate.h

I did before I replied.

>
> Also you can run sparse, with CONFIG_SPARSE_RCU_POINTER=y in
> your .config
>
> make C=2 net/ipv4/ip_tunnel.o
>
> And then you'll know the answer to this question.
>

Sounds like it is only to shut up a sparse warning, then its name
is misleading, we clearly don't dereference it here.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists