qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] gdbstub: set listen backlog to 1
@ 2016-05-04  9:32 Peter Wu
  2016-05-29  7:55 ` Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Wu @ 2016-05-04  9:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

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 <peter@lekensteyn.nl>
---
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

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

* Re: [Qemu-devel] [PATCH] gdbstub: set listen backlog to 1
  2016-05-04  9:32 [Qemu-devel] [PATCH] gdbstub: set listen backlog to 1 Peter Wu
@ 2016-05-29  7:55 ` Michael Tokarev
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2016-05-29  7:55 UTC (permalink / raw)
  To: Peter Wu, qemu-devel; +Cc: qemu-trivial

04.05.2016 12:32, Peter Wu wrote:
> 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.

Applied to -trivial, thanks!

/mjt

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

end of thread, other threads:[~2016-05-29  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04  9:32 [Qemu-devel] [PATCH] gdbstub: set listen backlog to 1 Peter Wu
2016-05-29  7:55 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).