Date: Mon, 24 Jul 2006 07:20:17 GMT From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/100585: [PATCH] top -s0 causes load excessive Message-ID: <200607240720.k6O7KHrs092389@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/100585; it has been noted by GNATS.
From: Bruce Evans <bde@zeta.org.au>
To: Roberto Lima <roberto@forbrazil.com.br>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607240720.k6O7KHrs092389>
