From owner-svn-src-head@freebsd.org Fri Mar 23 18:34:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A5DCF62965; Fri, 23 Mar 2018 18:34:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 118D285180; Fri, 23 Mar 2018 18:34:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEF0E239A7; Fri, 23 Mar 2018 18:34:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NIYcoc066085; Fri, 23 Mar 2018 18:34:38 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIYcm6066082; Fri, 23 Mar 2018 18:34:38 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803231834.w2NIYcm6066082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 23 Mar 2018 18:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331454 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 331454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:34:39 -0000 Author: sbruno Date: Fri Mar 23 18:34:38 2018 New Revision: 331454 URL: https://svnweb.freebsd.org/changeset/base/331454 Log: Revert r331379 as the "simple" lock changes have revealed a deeper problem and need for a rethink. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Modified: head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet/ip_output.c Fri Mar 23 18:34:38 2018 (r331454) @@ -1314,14 +1314,12 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; case IP_PORTRANGE: - INP_RLOCK(inp); if (inp->inp_flags & INP_HIGHPORT) optval = IP_PORTRANGE_HIGH; else if (inp->inp_flags & INP_LOWPORT) optval = IP_PORTRANGE_LOW; else optval = 0; - INP_RUNLOCK(inp); break; case IP_ONESBCAST: @@ -1347,11 +1345,9 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; #ifdef RSS case IP_RSSBUCKETID: - INP_RLOCK(inp); retval = rss_hash2bucket(inp->inp_flowid, inp->inp_flowtype, &rss_bucket); - INP_RUNLOCK(inp); if (retval == 0) optval = rss_bucket; else Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet/raw_ip.c Fri Mar 23 18:34:38 2018 (r331454) @@ -639,12 +639,10 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt) sizeof optval); if (error) break; - INP_WLOCK(inp); if (optval) inp->inp_flags |= INP_HDRINCL; else inp->inp_flags &= ~INP_HDRINCL; - INP_WUNLOCK(inp); break; case IP_FW3: /* generic ipfw v.3 functions */ Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet6/ip6_output.c Fri Mar 23 18:34:38 2018 (r331454) @@ -1498,10 +1498,8 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt) error = soopt_mcopyin(sopt, m); /* XXX */ if (error != 0) break; - INP_WLOCK(in6p); error = ip6_pcbopts(&in6p->in6p_outputopts, m, so, sopt); - INP_WUNLOCK(in6p); m_freem(m); /* XXX */ break; } @@ -1637,13 +1635,11 @@ do { \ error = EINVAL; break; } - INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(IPV6_HOPLIMIT, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } @@ -1694,10 +1690,8 @@ do { \ * available only prior to bind(2). * see ipng mailing list, Jun 22 2001. */ - INP_WLOCK(in6p); if (in6p->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { - INP_WUNLOCK(in6p); error = EINVAL; break; } @@ -1706,7 +1700,6 @@ do { \ in6p->inp_vflag &= ~INP_IPV4; else in6p->inp_vflag |= INP_IPV4; - INP_WUNLOCK(in6p); break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ @@ -1756,13 +1749,11 @@ do { \ break; { struct ip6_pktopts **optp; - INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } @@ -1827,6 +1818,12 @@ do { \ int optlen; struct ip6_pktopts **optp; + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + /* * We only ensure valsize is not too large * here. Further validation will be done @@ -1836,21 +1833,12 @@ do { \ sizeof(optbuf_storage), 0); if (error) break; - - INP_WLOCK(in6p); - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - INP_WUNLOCK(in6p); - error = EINVAL; - break; - } optlen = sopt->sopt_valsize; optbuf = optbuf_storage; optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, optbuf, optlen, optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } #undef OPTSET @@ -2035,12 +2023,10 @@ do { \ break; #ifdef RSS case IPV6_RSSBUCKETID: - INP_RLOCK(in6p); retval = rss_hash2bucket(in6p->inp_flowid, in6p->inp_flowtype, &rss_bucket); - INP_RUNLOCK(in6p); if (retval == 0) optval = rss_bucket; else @@ -2243,8 +2229,6 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf * int error = 0; struct thread *td = sopt->sopt_td; - INP_WLOCK_ASSERT(sotoinpcb(so)); - /* turn off any old options. */ if (opt) { #ifdef DIAGNOSTIC @@ -3103,8 +3087,6 @@ int ip6_optlen(struct inpcb *in6p) { int len; - - INP_WLOCK_ASSERT(in6p); if (!in6p->in6p_outputopts) return 0;