Date: Fri, 12 Sep 1997 01:12:12 +0200 From: sthaug@nethelp.no To: fenner@FreeBSD.ORG Cc: freebsd-bugs@hub.freebsd.org Subject: Re: kern/3925 Message-ID: <402.874019532@verdi.nethelp.no> In-Reply-To: Your message of "Sat, 5 Jul 1997 11:55:59 -0700 (PDT)" References: <199707051855.LAA16321@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> Synopsis: SO_SNDLOWAT of 0 causes kernel to use 99% of CPU time on TCP send > > State-Changed-From-To: open-feedback > State-Changed-By: fenner > State-Changed-When: Sat Jul 5 11:55:17 PDT 1997 > State-Changed-Why: > Could you verify that rev 1.27 of kern/uipc_socket.c fixes this problem? Hi, sorry this took so long - I'm afraid your message arrived during vacation time here, and got lost in my mailbox. Anyway, I have tested the patch, and it looks good. My problem has been resolved, and the test program now gets EINVAL as it should. Please note that I haven't been able to test 1.27 directly. What I did was: - Grab uipc_socket.c 1.30 from FreeBSD-current at ftp.cdrom.com. - Locate the changes related to kern/3925. - Backport these changes to my current system (2.2-970801-RELENG, with uipc_socket.c 1.20.2.1). - And test the new kernel based on these changes. Below is a context diff against uipc_socket.c 1.20.2.1 - this could probably go into the RELENG_2_2 branch. Steinar Haug, Nethelp consulting, sthaug@nethelp.no ---------------------------------------------------------------------- *** uipc_socket.c.orig Tue Dec 3 11:48:58 1996 --- uipc_socket.c Fri Sep 12 00:31:57 1997 *************** *** 893,922 **** case SO_RCVBUF: case SO_SNDLOWAT: case SO_RCVLOWAT: if (m == NULL || m->m_len < sizeof (int)) { error = EINVAL; goto bad; } switch (optname) { case SO_SNDBUF: case SO_RCVBUF: if (sbreserve(optname == SO_SNDBUF ? &so->so_snd : &so->so_rcv, ! (u_long) *mtod(m, int *)) == 0) { error = ENOBUFS; goto bad; } break; case SO_SNDLOWAT: ! so->so_snd.sb_lowat = *mtod(m, int *); break; case SO_RCVLOWAT: ! so->so_rcv.sb_lowat = *mtod(m, int *); break; } break; case SO_SNDTIMEO: case SO_RCVTIMEO: --- 893,945 ---- case SO_RCVBUF: case SO_SNDLOWAT: case SO_RCVLOWAT: + { + int optval; + if (m == NULL || m->m_len < sizeof (int)) { error = EINVAL; goto bad; } + + /* + * Values < 1 make no sense for any of these + * options, so disallow them. + */ + optval = *mtod(m, int *); + if (optval < 1) { + error = EINVAL; + goto bad; + } + switch (optname) { case SO_SNDBUF: case SO_RCVBUF: if (sbreserve(optname == SO_SNDBUF ? &so->so_snd : &so->so_rcv, ! (u_long) optval) == 0) { error = ENOBUFS; goto bad; } break; + /* + * Make sure the low-water is never greater than + * the high-water. + */ case SO_SNDLOWAT: ! so->so_snd.sb_lowat = ! (optval > so->so_snd.sb_hiwat) ? ! so->so_snd.sb_hiwat : optval; break; case SO_RCVLOWAT: ! so->so_rcv.sb_lowat = ! (optval > so->so_rcv.sb_hiwat) ? ! so->so_rcv.sb_hiwat : optval; break; } break; + } case SO_SNDTIMEO: case SO_RCVTIMEO:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?402.874019532>