netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
To: Andrei Vagin <avagin@virtuozzo.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Linux NetDev <netdev@vger.kernel.org>
Subject: Re: net: do not allow changing SO_REUSEADDR/SO_REUSEPORT on bound sockets
Date: Wed, 6 Jun 2018 17:25:51 -0700	[thread overview]
Message-ID: <CANP3RGdXpjWu-QEqGbfOv39p_NkE3eZNK2+orzTGdynH6dtPtA@mail.gmail.com> (raw)
In-Reply-To: <20180606232524.GA3632@outlook.office365.com>

Yes, it does, we found this internally last night and been debating
what to do about it.

Fundamentally what it points out is that prior to this patch CRIU
could get the host into an inconsistent state.
It inserts all the sockets into the hashtables with SO_REUSEADDR set,
and then (potentially) clears it on some of them...
But the tb cache still thinks it's set on all of them.
So later attempts to bind() a socket with SO_REUSEADDR set can then
succeed even though they should fail (or something like that).

I wonder if we instead need a socket option to basically say 'ignore
all conflicts' that CRIU could set, and then clear post
bind/listen/connect
hash table insertion...

Or maybe the transition from 1->0 is valid, but from 0->1 isn't??

Or we need special per-protocol code in the SO_REUSE{ADDR,PORT}
setsockopt handler to recalculate the tb cache?

Anyone have any smart ideas?

  reply	other threads:[~2018-06-07  0:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-03 17:47 [PATCH] net: do not allow changing SO_REUSEADDR/SO_REUSEPORT on bound sockets Maciej Żenczykowski
2018-06-03 19:54 ` Christoph Paasch
2018-06-04 17:24 ` Eric Dumazet
2018-06-04 21:14 ` David Miller
2018-06-06 23:25 ` Andrei Vagin
2018-06-07  0:25   ` Maciej Żenczykowski [this message]
2018-06-07  5:51     ` Andrei Vagin
2018-06-08 10:07       ` Maciej Żenczykowski
2018-06-11 18:35         ` Andrei Vagin
2018-06-11 18:57 ` Andrei Vagin
2018-06-11 21:25 ` [PATCH] " Marc Dionne
2018-06-11 22:29   ` Maciej Żenczykowski
2018-06-11 23:09     ` Marc Dionne

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=CANP3RGdXpjWu-QEqGbfOv39p_NkE3eZNK2+orzTGdynH6dtPtA@mail.gmail.com \
    --to=zenczykowski@gmail.com \
    --cc=avagin@virtuozzo.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --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).