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: <20191120211348.GD29650@unicorn.suse.cz>
Date:   Wed, 20 Nov 2019 22:13:48 +0100
From:   Michal Kubecek <mkubecek@...e.cz>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     Eric Dumazet <eric.dumazet@...il.com>,
        netdev <netdev@...r.kernel.org>, Firo Yang <firo.yang@...e.com>
Subject: Re: possible race in __inet_lookup_established()

On Wed, Nov 20, 2019 at 12:57:48PM -0800, Eric Dumazet wrote:
> On Wed, Nov 20, 2019 at 12:49 PM Michal Kubecek <mkubecek@...e.cz> wrote:
> > Firo suggested something like
> >
> > ------------------------------------------------------------------------
> > --- a/net/ipv4/inet_hashtables.c
> > +++ b/net/ipv4/inet_hashtables.c
> > @@ -362,6 +362,8 @@ struct sock *__inet_lookup_established(struct net *net,
> >
> >  begin:
> >         sk_nulls_for_each_rcu(sk, node, &head->chain) {
> > +               if (unlikely(!node))
> > +                       goto begin;
> >                 if (sk->sk_hash != hash)
> >                         continue;
> >                 if (likely(INET_MATCH(sk, net, acookie,
> > ------------------------------------------------------------------------
> >
> > It depends on implementation details but I believe it would work. It
> > would be nicer if we could detect the switch to a listening socket but
> > I don't see how to make such test race free without introducing
> > unacceptable performance penalty.
> 
> No, we do not want to add more checks in the fast path really.
> 
> I was more thinking about not breaking the RCU invariants.
> 
> (ie : adding back the nulls stuff that I removed in 3b24d854cb35
> ("tcp/dccp: do not touch
> listener sk_refcnt under synflood")

Yes, that would do the trick. It would add some cycles to listener
lookup but that is less harm than slowing down established socket
lookup.

Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ