From owner-freebsd-bugs@FreeBSD.ORG Mon Jul 24 07:20:18 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 962C616A4DA for ; Mon, 24 Jul 2006 07:20:18 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 27ABD43D49 for ; Mon, 24 Jul 2006 07:20:18 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k6O7KHJx092391 for ; Mon, 24 Jul 2006 07:20:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k6O7KHrs092389; Mon, 24 Jul 2006 07:20:17 GMT (envelope-from gnats) Date: Mon, 24 Jul 2006 07:20:17 GMT Message-Id: <200607240720.k6O7KHrs092389@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bruce Evans Cc: Subject: Re: bin/100585: [PATCH] top -s0 causes load excessive X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Bruce Evans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2006 07:20:18 -0000 The following reply was made to PR bin/100585; it has been noted by GNATS. From: Bruce Evans To: Roberto Lima Cc: freebsd-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org, dwmalone@FreeBSD.org Subject: Re: bin/100585: [PATCH] top -s0 causes load excessive Date: Mon, 24 Jul 2006 17:14:22 +1000 (EST) 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