From owner-freebsd-stable Wed Sep 20 8:31:53 2000 Delivered-To: freebsd-stable@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id D075937B42C for ; Wed, 20 Sep 2000 08:31:50 -0700 (PDT) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e8KFVlq04033; Wed, 20 Sep 2000 08:31:47 -0700 (PDT) Date: Wed, 20 Sep 2000 08:31:47 -0700 From: Alfred Perlstein To: Maxime Henrion Cc: stable@FreeBSD.ORG Subject: Re: internal identd problem Message-ID: <20000920083147.U9141@fw.wintelcom.net> References: <39C8CD9B.17F70429@qualys.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: <39C8CD9B.17F70429@qualys.com>; from mux@qualys.com on Wed, Sep 20, 2000 at 04:45:47PM +0200 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Maxime Henrion [000920 08:17] wrote: > Hi, > > > I read the thread about the cpu hog problem of the internal identd > problem and tried to reproduce it on my box. I did a truss on the inetd > process and got this : > > select(0x8,0xbfbff46c,0x0,0x0,0xbfbfd45c) = 1 (0x1) > ioctl(7,FIONREAD,0xbfbfd444) = 0 (0x0) > read(0x7,0xbfbfd46c,0x0) = 0 (0x0) > gettimeofday(0xbfbfd45c,0x0) = 0 (0x0) > [...] > > a lot of times. > > It seems it's a very common problem. The return value of read() is not > checked against 0 (0 means that the other side disconnected) and so, it > loops until the connection times out. > > I will look at inetd sources to fix this bug as soon as possible and I > think I will come shortly with a patch. Give this a shot: Index: builtins.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/builtins.c,v retrieving revision 1.24 diff -u -u -r1.24 builtins.c --- builtins.c 2000/07/12 20:49:06 1.24 +++ builtins.c 2000/09/20 14:55:01 @@ -478,7 +478,7 @@ if (onreadlen > bufsiz) onreadlen = bufsiz; ssize = read(s, &buf[size], (size_t)onreadlen); - if (ssize == -1) + if (ssize < 1) iderror(0, 0, s, errno); bufsiz -= ssize; size += ssize; -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message