Re: [PATCH] tcp: Fix tcp_max_syn_backlog limit on connection requests
From: Ttttabcd <hidden>
Date: 2020-01-03 13:07:42
I would prefer not changing this code, unless you prove there is a real problem. (sysctl_max_syn_backlog defauts to 4096, and syncookies are enabled by default, for a good reason) Basically, sysctl_max_syn_backlog is not used today (because syncookies are enabled...) Your change might break users that suddenly will get behavior changes if their sysctl_max_syn_backlog was set to a small value. Unfortunately some sysctl values are often copied/pasted from various web pages claiming how to get best TCP performance. It would be quite silly to change the kernel to adapt a change (sysctl_max_syn_backlog set to 200 ... ) done by one of these admins. Thanks.
Of course, the sysctl_max_syn_backlog is set to 200 just for the sake of example, not the actual configuration. I found this bug when summarizing how the kernel handles syn attacks. I'm reading the kernel source code and not really encountering errors. I also thought of another scenario where the above BUG might cause problems. Imagine a machine with low performance and small memory. Set sysctl_max_syn_backlog to a small value to save memory (304 bytes for a connection request), and enable syn cookies to handle excessive requests. Because the sysctl_max_syn_backlog is invalid after syn cookies are enabled, the entire backlog is consumed and too much memory is consumed. Of course, the above scenario is rarely encountered in general. I fixed this bug mainly because I thought its logic was indeed wrong, not because it caused some serious problems, I was a bit obsessive about the correctness of the code. So if, as you said, it can cause backward compatibility issues, just leave it as it is.