Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jun 2018 20:00:22 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r334730 - stable/11/sys/netinet
Message-ID:  <201806062000.w56K0MaR006463@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806062000.w56K0MaR006463>