Received: from eggs.gnu.org ([2001:4830:134:3::10]:36872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axtBk-0004g1-E1 for qemu-devel@nongnu.org; Wed, 04 May 2016 05:33:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axtBY-0003gg-Iw for qemu-devel@nongnu.org; Wed, 04 May 2016 05:33:42 -0400 From: Peter Wu Date: Wed, 4 May 2016 11:32:17 +0200 Message-Id: <1462354337-1733-1-git-send-email-peter@lekensteyn.nl> Subject: [Qemu-devel] [PATCH] gdbstub: set listen backlog to 1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org Avoid possible connection drops on Linux (when tcp_syncookies is disabled) or fallbacks to SYN cookies with the following kernel warning: TCP: request_sock_TCP: Possible SYN flooding on port 1234. Sending cookies. Check SNMP counters. Since Linux 4.4 (ef547f2ac16b "tcp: remove max_qlen_log"), a backlog of zero is really treated as the "queue length for completely established sockets waiting to be accepted" (listen(2)). This is apparently a valid interpretation of an "implementation-defined minimum value" for a backlog value of 0 (listen(3p)). Previous kernels would use 8 as minimum value, but that is no longer the case. Signed-off-by: Peter Wu --- Hi, This was also reported at Linux, but the author of that patch argued that it is intended behavior[1]. Kind regards, Peter [1]: https://lkml.kernel.org/r/1462321544.5535.337.camel@edumazet-glaptop3.roam.corp.google.com --- gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdbstub.c b/gdbstub.c index b126bf5..f181dc3 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1630,7 +1630,7 @@ static int gdbserver_open(int port) close(fd); return -1; } - ret = listen(fd, 0); + ret = listen(fd, 1); if (ret < 0) { perror("listen"); close(fd); -- 2.8.0