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]
Date:	Thu, 11 Dec 2014 15:13:02 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	psusi@...ntu.com
Cc:	netdev@...r.kernel.org
Subject: Re: bind() should not return -EADDRINUSE

From: Phillip Susi <psusi@...ntu.com>
Date: Thu, 11 Dec 2014 14:50:48 -0500

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 12/11/2014 2:23 PM, David Miller wrote:
>> From: Phillip Susi <psusi@...ntu.com> Date: Thu, 11 Dec 2014
>> 14:19:11 -0500
>> 
>>> Attempting to establish a connection to a remote host using the
>>> same local port, but a different remote port as the previous
>>> connection ( that is still in TIME_WAIT ) results in bind()
>>> returning -EADDRINUSE. By changing the remote port, you avoid the
>>> conflict with the other connection that is in TIME_WAIT, but
>>> since the remote port is not known when bind() is called, it
>>> incorrectly returns -EADDRINUSE.  This check should not be done
>>> in bind(), but deferred until the remote port is known in the
>>> call to connect(), or listen().
>> 
>> Bind has to allocate and hold from everyone else on the system the 
>> local port at bind() time, so we cannot defer this decision.
> 
> What on earth for?  If two processes are going to connect to different
> remotes using the same source, that is perfectly fine.  The only
> contention is if two processes want to listen() with the same local
> addr and wildcard remote.

But you don't know ahead of time what the processes are going to
do, that's the problem.

You cannot leave the port available and pretend to another process
that he will be able to use it.

Port allocation failures must be signalled at bind() time.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ