Fixed port-share bug with DoS potential
Quoted 33 lines · James Yonan
Fixed port-share bug that can cause segfault when the number of concurrent connections is large.
The issue is that the port-share code calls
openvpn_connect()which in turn callsselect(). When there are a high number of concurrent port-share connections, the fd passed to select can potentially exceedFD_SETSIZE, causing undefined behavior.The fix is to use
poll()(if available) instead ofselect().Signed-off-by James Yonan <[email protected]...>--- src/openvpn/socket.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)src/openvpn/socket.c +6
-0@@ -1149,6 +1149,12 @@ openvpn_connect (socket_descriptor_t sd, {while (true) { +#if POLL +struct pollfd fds[1 ]; + fds[0 ].fd = sd; + fds[0 ].events =POLLOUT ; + status =poll (fds,1 ,0 ); +#else fd_set writes;struct timeval tv;
src/openvpn/socket.c openvpn_connect (socket_descriptor_t sd, · line 1170
Quoted 8 lines
src/openvpn/socket.c +1
-1@@ -1158,7 +1164,7 @@ openvpn_connect (socket_descriptor_t sd, tv.tv_usec =0 ; status =select (sd +1 ,NULL , &writes,NULL , &tv); - +#endif if (signal_received) {get_signal (signal_received);
ACK
Note that since patch e0b3fd49 in master and 1746908f in release/2.3 this no longer causes a segfault, but triggers an ASSERT().
In the long run, we should migrate away from select() completely.
-Steffan
(This patch was first discussed and reviewed on the closed security@ list)
ACK.
Your patch has been applied to the master and release/2.3 branch.
commit 007738e9d6030c8989713543e4f7308ff57be30f (master) commit 9030fd4cc6283e30f927f950310fc0f83edb5e4d (release/2.3)
Author: James Yonan Date: Thu Mar 3 00:48:12 2016 -0700
Fixed port-share bug with DoS potential
Signed-off-by: James Yonan <[email protected]...>
Acked-by: Steffan Karger <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11626
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering