Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jul 2006 17:14:22 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Roberto Lima <roberto@forbrazil.com.br>
Cc:        freebsd-bugs@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org, dwmalone@FreeBSD.org
Subject:   Re: bin/100585: [PATCH] top -s0 causes load excessive
Message-ID:  <20060724170139.O59044@delplex.bde.org>
In-Reply-To: <200607192319.k6JNJM7Y013857@www.freebsd.org>
References:  <200607192319.k6JNJM7Y013857@www.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060724170139.O59044>