Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] inet: Fixes for inet_csk_get_port and soreusport
@ 2016-12-15  0:54 Tom Herbert
  2016-12-15  0:54 ` [PATCH net-next 1/2] inet: Don't go into port scan when looking for specific bind port Tom Herbert
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tom Herbert @ 2016-12-15  0:54 UTC (permalink / raw)
  To: davem, netdev; +Cc: kernel-team, jbacik, eric.dumazet, raigatgoog

This patch set fixes a couple of issues I noticed while debugging our
softlockup issue in inet_csk_get_port.

- Don't allow jump into port scan in inet_csk_get_port if function
  was called with non-zero port number (looking up explicit port
  number).
- When inet_csk_get_port is called with zero port number (ie. perform
  scan) an reuseport is set on the socket, don't match sockets that
  also have reuseport set. The intent from the user should be
  to get a new port number and then explictly bind other
  sockets to that number using soreuseport.

Tested:

Ran first patch on production workload with no ill effect.

For second patch, ran a little listener application and first
demonstrated that unbound sockets with soreuseport can indeed
be bound to unrelated soreuseport sockets.


Tom Herbert (2):
  inet: Don't go into port scan when looking for specific bind port
  inet: Fix get port to handle zero port number with soreuseport set

 include/net/inet6_connection_sock.h |  3 ++-
 include/net/inet_connection_sock.h  |  6 ++++--
 net/ipv4/inet_connection_sock.c     | 16 ++++++++++------
 net/ipv6/inet6_connection_sock.c    |  7 ++++---
 4 files changed, 20 insertions(+), 12 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH net-next 2/2] inet: Fix get port to handle zero port number with soreuseport set
@ 2016-12-15 15:58 Craig Gallek
  0 siblings, 0 replies; 5+ messages in thread
From: Craig Gallek @ 2016-12-15 15:58 UTC (permalink / raw)
  To: Tom Herbert; +Cc: David Miller, netdev, kernel-team, Josef Bacik, Eric Dumazet

On Wed, Dec 14, 2016 at 7:54 PM, Tom Herbert <tom@herbertland.com> wrote:
> A user may call listen with binding an explicit port with the intent
> that the kernel will assign an available port to the socket. In this
> case inet_csk_get_port does a port scan. For such sockets, the user may
> also set soreuseport with the intent a creating more sockets for the
> port that is selected. The problem is that the initial socket being
> opened could inadvertently choose an existing and unreleated port
> number that was already created with soreuseport.
Good catch!  I think this problem may also exist in the UDP path?
(udp_lib_get_port -> udp_lib_lport_inuse[2])

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-17 16:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-15  0:54 [PATCH net-next 0/2] inet: Fixes for inet_csk_get_port and soreusport Tom Herbert
2016-12-15  0:54 ` [PATCH net-next 1/2] inet: Don't go into port scan when looking for specific bind port Tom Herbert
2016-12-15  0:54 ` [PATCH net-next 2/2] inet: Fix get port to handle zero port number with soreuseport set Tom Herbert
2016-12-17 16:13 ` [PATCH net-next 0/2] inet: Fixes for inet_csk_get_port and soreusport David Miller
  -- strict thread matches above, loose matches on Subject: below --
2016-12-15 15:58 [PATCH net-next 2/2] inet: Fix get port to handle zero port number with soreuseport set Craig Gallek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox