svn commit: r334730 - stable/11/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Wed Jun 6 20:00:23 UTC 2018


Author: tuexen
Date: Wed Jun  6 20:00:21 2018
New Revision: 334730
URL: https://svnweb.freebsd.org/changeset/base/334730

Log:
  MFC r334494:
  
  Ensure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT.
  
  If the sysctl variable is set to a value larger than TCP_MAXRXTSHIFT+1,
  the array tcp_syn_backoff[] is accessed out of bounds.
  
  Discussed with:	jtl@
  Sponsored by:	Netflix, Inc.

Modified:
  stable/11/sys/netinet/tcp_syncache.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_syncache.c
==============================================================================
--- stable/11/sys/netinet/tcp_syncache.c	Wed Jun  6 19:56:19 2018	(r334729)
+++ stable/11/sys/netinet/tcp_syncache.c	Wed Jun  6 20:00:21 2018	(r334730)
@@ -175,8 +175,27 @@ SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, hashsize
     &VNET_NAME(tcp_syncache.hashsize), 0,
     "Size of TCP syncache hashtable");
 
-SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit, CTLFLAG_VNET | CTLFLAG_RW,
+static int
+sysctl_net_inet_tcp_syncache_rexmtlimit_check(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	u_int new;
+
+	new = V_tcp_syncache.rexmt_limit;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if ((error == 0) && (req->newptr != NULL)) {
+		if (new > TCP_MAXRXTSHIFT)
+			error = EINVAL;
+		else
+			V_tcp_syncache.rexmt_limit = new;
+	}
+	return (error);
+}
+
+SYSCTL_PROC(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit,
+    CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW,
     &VNET_NAME(tcp_syncache.rexmt_limit), 0,
+    sysctl_net_inet_tcp_syncache_rexmtlimit_check, "UI",
     "Limit on SYN/ACK retransmissions");
 
 VNET_DEFINE(int, tcp_sc_rst_sock_fail) = 1;


More information about the svn-src-all mailing list