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:	Sat, 2 Apr 2011 20:46:11 +0200
From:	Cyril Bonté <cyril.bonte@...e.fr>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	netdev@...r.kernel.org, Daniel Baluta <daniel.baluta@...il.com>,
	Gaspar Chilingarov <gasparch@...il.com>,
	Charles Duffy <charles@...is.net>, Willy Tarreau <w@....eu>
Subject: Re: tcp: disallow bind() to reuse addr/port regression in 2.6.38

Le samedi 2 avril 2011 20:10:48, Eric Dumazet a écrit :
> Le samedi 02 avril 2011 à 20:01 +0200, Cyril Bonté a écrit :
> (...)
> > > 		if (shutdown(listenfd, SHUT_WR) == 0 &&
> > 		
> > 		    listen(listenfd, 1024) == 0 &&
> > 		    shutdown(listenfd, SHUT_RD) == 0) {
> > 			
> > 			printf("shutdown OK\n");
> > 		
> > 		}
> > 	
> > 	}
> > 	exit(0);
> > 
> > }
> 
> Wow, not clear what this is doing....
> 
> for sure the listen() call is not needed ?
> 
> And the shutdown(listenfd, SHUT_WR) is clearly useless too.

Well, I'm not the best one to explain that part but from what i read in the 
comments of this part of code, both listen and SHUT_WR are used to detect 
errors on various OS (OpenBSD, Solaris, ...).

> I feel you only needed the shutdown(listenfd, SHUT_RD) call.
> 
> Why haproxy needs to setup a second listening socket on same port ?

I simplified the test case, which is far from what haproxy do (just forgot to 
explain the real behaviour).
To reload the configuration, a new haproxy process is launched, sending a 
signal to the previous one and asking it to free the ports for a while (the 
shutdown part in the test). The new process then tries to bind the ports, 
which worked until 2.6.38 (if an error occurs, a new signal is sent to the 
previous process to listen to its sockets again).

-- 
Cyril Bonté
--
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