Re: High Resolution Timer DOS

From: matthieu castet
Date: Sun Apr 29 2007 - 12:08:55 EST


Ingo Molnar wrote:
* Lee Revell <rlrevell@xxxxxxxxxxx> wrote:

Well, it is not really a DoS. The rescheduling of the process is limited by the scheduler and the available CPU time (depending on the number of runnable tasks in the system).
Shouldn't an unprivileged process be rate limited somehow to avoid flooding the machine with interrupts? We restrict nonroot users from setting the RTC interrupt rate higher than 64Hz for a similar reason (granted, this limit dates back to the 486 days and should probably be increased to 1024 Hz).

No. An interrupt in this case is really just 'CPU time used up', and an unprivileged process can take up as much CPU time as the scheduler allows. So it's _not_ a DoS, and neither is any other unprivileged infinit loop (or high-rate context-switching task) a DoS.
Ok, may be DOS was not the correct term, but with the 2.6.21 hrt there is a great difference between an infinite loop and the high-rate context-switching task (you can try attached programs).
With the first I the system is still responsive, with the latter it isn't (new process take lot's of time to get created, other process are very slow).
If it is "just 'CPU time used up'", why I see a such difference between the 2 cases ?

Maybe the current scheduler failed to handle correctly this case ?


Matthieu #include <string.h>
#include <sys/time.h>
#include <time.h>

int main()
{
struct timeval tv;
while (1)
gettimeofday(&tv, NULL);
}
int main()
{
while (1)
usleep(1);
}