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]
Date:   Wed, 20 Nov 2019 13:54:18 -0800
From:   Eric Dumazet <edumazet@...gle.com>
To:     Michal Kubecek <mkubecek@...e.cz>
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 1:13 PM Michal Kubecek <mkubecek@...e.cz> wrote:
>
> 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.
>

It should not change cycles spent in listener lookup.

Only the test to check for the iteration end will not use NULL, that's about it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ