From owner-freebsd-bugs@FreeBSD.ORG Mon Jul 24 07:14:26 2006 Return-Path: X-Original-To: freebsd-bugs@FreeBSD.org Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7EDE216A4DE; Mon, 24 Jul 2006 07:14:26 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1CFE943D46; Mon, 24 Jul 2006 07:14:26 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id B088810B05D; Mon, 24 Jul 2006 17:14:24 +1000 (EST) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k6O7EMFL008820; Mon, 24 Jul 2006 17:14:23 +1000 Date: Mon, 24 Jul 2006 17:14:22 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Roberto Lima In-Reply-To: <200607192319.k6JNJM7Y013857@www.freebsd.org> Message-ID: <20060724170139.O59044@delplex.bde.org> References: <200607192319.k6JNJM7Y013857@www.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-bugs@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org, dwmalone@FreeBSD.org Subject: Re: bin/100585: [PATCH] top -s0 causes load excessive X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2006 07:14:26 -0000 On Wed, 19 Jul 2006, Roberto Lima wrote: >> Description: > I see that my costumers have been used 'top -s0' too many times and this is overloading in my system. >> How-To-Repeat: > just use 'top -s0' and see the load average going up. >> Fix: > --- top.c.old Wed Jul 19 19:49:23 2006 > +++ top.c Wed Jul 19 19:49:32 2006 > @@ -331,7 +331,7 @@ > break; > > case 's': > - if ((delay = atoi(optarg)) < 0 || (delay == 0 && getuid() != 0)) > + if ((delay = atoi(optarg)) < 1 || (delay == 0 && getuid() != 0)) This would just break the feature that a delay of 0 works for non-root. It is already broken for root. top hasn't used kmem or been setuid for a long time so it shouldn't call getuid() here or elsewhere. Users who wish to overload the system can do it in more or less interesting ways than with "top -s0", e.g., with "while :; do top 15 | cat; done". Bruce