linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Craig Gallek <kraigatgoog@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] udp: fix potential infinite loop in SO_REUSEPORT logic
Date: Tue, 19 Jan 2016 12:15:28 -0500	[thread overview]
Message-ID: <CAEfhGiz+gD+Lxdetbwxpxv=U9R5sfA0oR5+pgoEdHtWfojj2MA@mail.gmail.com> (raw)
In-Reply-To: <1453221403.1223.266.camel@edumazet-glaptop2.roam.corp.google.com>

On Tue, Jan 19, 2016 at 11:36 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Using a combination of connected and un-connected sockets, Dmitry
> was able to trigger soft lockups with his fuzzer.
>
> The problem is that sockets in the SO_REUSEPORT array might have
> different scores.
>
> Right after sk2=socket(), setsockopt(sk2,...,SO_REUSEPORT, on) and
> bind(sk2, ...), but _before_ the connect(sk2) is done, sk2 is added into
> the soreuseport array, with a score which is smaller than the score of
> first socket sk1 found in hash table (I am speaking of the regular UDP
> hash table), if sk1 had the connect() done, giving a +8 to its score.
>
> hash bucket [X] -> sk1 -> sk2 -> NULL
>
> sk1 score = 14  (because it did a connect())
> sk2 score = 6
>
> SO_REUSEPORT fast selection is an optimization. If it turns out the
> score of the selected socket does not match score of first socket, just
> fallback to old SO_REUSEPORT logic instead of trying to be too smart.
>
> Normal SO_REUSEPORT users do not mix different kind of sockets, as this
> mechanism is used for load balance traffic.
>
> Fixes: e32ea7e74727 ("soreuseport: fast reuseport UDP socket selection")
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Craig Gallek <kraigatgoog@gmail.com>

Thanks Eric!

Acked-by: Craig Gallek <kraig@google.com>

  reply	other threads:[~2016-01-19 17:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18 18:33 net: hang in ip_finish_output Craig Gallek
2016-01-19  2:20 ` Eric Dumazet
2016-01-19  2:49   ` Eric Dumazet
2016-01-19 16:13     ` Craig Gallek
2016-01-19 16:36       ` [PATCH net] udp: fix potential infinite loop in SO_REUSEPORT logic Eric Dumazet
2016-01-19 17:15         ` Craig Gallek [this message]
2016-01-19 18:53         ` David Miller

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='CAEfhGiz+gD+Lxdetbwxpxv=U9R5sfA0oR5+pgoEdHtWfojj2MA@mail.gmail.com' \
    --to=kraigatgoog@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).