bin/100585: [PATCH] top -s0 causes load excessive
Bruce Evans
bde at zeta.org.au
Mon Jul 24 07:20:18 UTC 2006
The following reply was made to PR bin/100585; it has been noted by GNATS.
From: Bruce Evans <bde at zeta.org.au>
To: Roberto Lima <roberto at forbrazil.com.br>
Cc: freebsd-gnats-submit at FreeBSD.org, freebsd-bugs at FreeBSD.org,
dwmalone at 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
More information about the freebsd-bugs
mailing list